define(function (require, exports, module) {
    return function (jQuery) {
        (function ($) {
            /*seajs-content-start*/
            var dateFormat = function (date, fmt) { //author: meizz
                var o = {
                    "M+": date.getMonth() + 1,                 //月份
                    "d+": date.getDate(),                    //日
                    "h+": date.getHours(),                   //小时
                    "m+": date.getMinutes(),                 //分
                    "s+": date.getSeconds(),                 //秒
                    "q+": Math.floor((date.getMonth() + 3) / 3), //季度
                    "S": date.getMilliseconds()             //毫秒
                };
                if (/(y+)/.test(fmt))
                    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
                for (var k in o)
                    if (new RegExp("(" + k + ")").test(fmt))
                        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                return fmt;
            };

            //获取两个时间差时，返回月、天、小时、分钟
            var getTimeDiffValue = function(time1,time2,fmt){
                var minute = 1000 * 60;
                var hour = minute * 60;
                var day = hour * 24;
                var month = day * 30;

                var diffValue = 0;
                switch(fmt){
                    case 'month':
                        diffValue=(time1-time2)/month;
                        break;
                    case 'day':
                        diffValue=(time1-time2)/day;
                        break;
                    case 'hour':
                        diffValue=(time1-time2)/hour;
                        break;
                    case 'minute':
                        diffValue=(time1-time2)/minute;
                        break;
                    default:
                        break;
                }
                return diffValue;
            };
            //计算后n分钟的时间
            function addMinutes(date,minutes)
            {
                minutes = parseInt(minutes);
                var interTimes = minutes*60*1000;
                interTimes = parseInt(interTimes);
                return new Date(Date.parse(date)+interTimes);
            }

            var defaultstarttime = new Date(new Date().setDate(new Date().getDate() - 7));
            var defaultendtime = new Date(new Date().setDate(new Date().getDate() - 1));
            //提交下载任务
            var submitDownloadTask = function (postdata,posturl) {
                $.ajax({
                    url: posturl,
                    type: "POST",
                    data: JSON.stringify(postdata),
                    dataType: "json",
                    success: function (result, textStatus) {
                        if(result){
                            alert('提交下载任务成功!');
                        }
                        else{
                            alert("提交下载任务失败!");
                        }
                    },
                    error:function(xmlHttpRequest,textStatus){
                        alert("请求出错!");
                    },
                    complete:function(xmlHttpRequest,textStatus){

                    }
                });
            };

            var _34Gctrl = function ($scope, httpservice) {
                $scope.minScore = "0";
                $scope.maxScore = "100";
                $scope.listValue = [];
                $scope.listScore = [];

                var formatterColor= function (cellvalue, options, rowObject) {
                    var colName = options.colModel.name;
                    var stylevalue="";
                    switch (colName){
                        case "3G":
                            if(cellvalue<400){
                                stylevalue="color:#ff0000";//红色
                            }
                            if(cellvalue>=400&&cellvalue<=500){
                                stylevalue="color:#ffb203";//黄色
                            }
                            break;
                        case "RAB":
                            if(cellvalue>1500){
                                stylevalue="color:#ff0000";//红色
                            }
                            if(cellvalue>=1000&&cellvalue<=1500){
                                stylevalue="color:#ffb203";//黄色
                            }
                            break;
                        case "PDP":
                            if(cellvalue>1800){
                                stylevalue="color:#ff0000";//红色
                            }
                            if(cellvalue>=1200&&cellvalue<=1800){
                                stylevalue="color:#ffb203";//黄色
                            }
                            break;
                        case "TCP":
                            if(cellvalue>800){
                                stylevalue="color:#ff0000";//红色
                            }
                            if(cellvalue>=500&&cellvalue<=800){
                                stylevalue="color:#ffb203";//黄色
                            }
                            break;
                        case "flowdown":
                            if(cellvalue>5000){
                                stylevalue="color:#ff0000";//红色
                            }
                            if(cellvalue>=3000&&cellvalue<=5000){
                                stylevalue="color:#ffb203";//黄色
                            }
                            break;
                        default:
                            break;
                    }
                    var listprint = "<span style='"+stylevalue+"' >"+cellvalue+"</span>";
                    return listprint;
                };
                var downloadoperate = function(cellvalue, options, rowObject){
                    var listprint = "<a class='viewmodel' href='javascript:'id='"+rowObject.id+"' title = '查看'><img src='../../../images/chakan.png' /></a>" +
                        "<a class='downloadmodel' style='margin: 0 15px;' href= '"+httpservice.downloadurl+""+rowObject.filename+".csv' target='_blank' id='"+rowObject.id+"' state='"+rowObject.status+"' title='下载'><img src='../../../images/download.png' /></a>" +
                        "<a class='deletemodel' href='javascript:' id='"+rowObject.id+"' state='"+rowObject.state+"' title='删除'><img src='../../../images/delete1.png' /></a>";
                    return listprint;
                };

                //删除下载文件
                $(".deletemodel").live("click",function(e){
                    var fileId = $(e.target).parent().attr("id");
                    if(confirm('你确定要删除该文件?')){
                        $.ajax({
                            url:httpservice.serverurl + "script/Common/DeleteTask",
                            type:"get",
                            data:{id:fileId},
                            dataType:"json",
                            success:function(result){
                                if(result.state){
                                    var condition = {
                                        mainmodule:"上网感知分析",
                                        submodule:"34G感知分析"
                                    }
                                    $scope.getDownloadList(condition);
                                    alert('删除成功!');
                                }
                                else{
                                    alert('删除失败!');
                                }
                            },
                            error:function(xmlHttpRequest,textStatus){
                                alert('请求出错!');
                            },
                            complete:function(xmlHttpRequest,textStatus){

                            }
                        });
                    }
                })

                $scope.grid1 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage();
                        }
                    },
                    griddata: {
                        colnames: ['日期','位置区码', '小区码', '34综合下载速率', 'RAB建立时长' ,"PDP上下文建立时长","TCP建立时长","小流量数据业务下载时长","评分"],
                        colmodel: [
                            { name: 'day', index: 'day', sortable: false, align:"center" },
                            { name: 'lac', index: 'lac', sortable: false, align:"center" },
                            { name: 'sac', index: 'sac', sortable: false, align:"center"},
                            { name: '3G', index: '3G', sortable: true, sorttype: 'number', align:"center",formatter:formatterColor},
                            { name: 'RAB', index: 'RAB', sortable: true, sorttype: 'number', align:"center",formatter:formatterColor},
                            { name: 'PDP', index: 'PDP', sortable: true, sorttype: 'number', align:"center",formatter:formatterColor},
                            { name: 'TCP', index: 'TCP', sortable: true, sorttype: 'number', align:"center",formatter:formatterColor},
                            { name: 'flowdown', index: 'flowdown', sortable: true, sorttype: 'number', align:"center",formatter:formatterColor},
                            { name: 'score', index: 'score', sortable: true, sorttype: 'number', align:"center"}
                        ],
                        data: [
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 },
//                            { day: "2015年7月5日", lac: 1000, sac:1000, "3G":1000, "RAB": 1000, "PDP":1000, "TCP":1000, "flowdown":1000, "score":1000 }
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width());
                        grid.setGridHeight(300);
                    }
                };

                $scope.downloadList = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.downloadList1.gridpagedata.nowpage = 1;
                            $scope.turnPageWAPByType();
                        },
                        toToppage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage>1){
                                $scope.downloadList1.gridpagedata.nowpage--;
                            }
                            $scope.turnPageWAPByType();
                        },
                        toNextpage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage<$scope.downloadList1.gridpagedata.totalpage){
                                $scope.downloadList1.gridpagedata.nowpage++;
                            }
                            $scope.turnPageWAPByType();
                        },
                        toLastpage: function(){
                            $scope.downloadList1.gridpagedata.nowpage = $scope.downloadList1.gridpagedata.totalpage;
                            $scope.turnPageWAPByType();
                        },
                        topage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage<1){
                                $scope.downloadList1.gridpagedata.nowpage = 1;
                            }
                            if($scope.downloadList1.gridpagedata.nowpage>$scope.downloadList1.gridpagedata.totalpage){
                                $scope.downloadList1.gridpagedata.nowpage = $scope.downloadList1.gridpagedata.totalpage;
                            }
                            $scope.turnPageWAPByType();
                        },
                        changePagesize: function(){
                            $scope.downloadList1.gridpagedata.nowpage = 1;
                            $scope.turnPageWAPByType();
                        }
                    },
                    griddata: {
                        colnames: ['ID','下载文件名', '创建时间','主模块','子模块','应用名称', '下载状态', '操作'],
                        colmodel: [
                            { name: 'id', index: 'id', sortable: false, align:"center",hidden:true },
                            { name: 'filename', index: 'filename', sortable: false, align:"center" },
                            { name: 'createtime', index: 'createtime', sortable: false, align:"center" },
                            { name: 'mainmodule',width:100, index: 'mainmodule', sortable: false, align:"center"},
                            { name: 'submodule',width:100, index: 'submodule', sortable: false, align:"center"},
                            { name: 'appname',width:100, index: 'appname', sortable: false,sorttype: 'number', align:"center"},
                            { name: 'status',width:100, index: 'status', sortable: false,sorttype: 'number', align:"center"},
                            { name: 'operate', index: 'operate', sortable: false, align:"center",formatter:downloadoperate}
                        ],
                        data: [
                            { "filename": "微信", "mainmodule": 1000, "submodule":1000, "appname":1000, "createtime": 1000,"status":1000, "operate":1000}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth(800);
                        grid.setGridHeight(300);
                    }
                };

                $scope.dialogList={
                    title:"下载列表",
                    ok:function(){},
                    cancel:function(){}
                };

                $scope.showDownloadlist = function(){
                    $scope.dialogList.show();
                    var condition = {
                        mainmodule:"上网感知分析",
                        submodule:"34G感知分析"
                    }
                    $scope.getDownloadList(condition);
//                    setInterval(function(){
//                        $.ajax({
//                            url:httpservice.serverurl + "script/Common/GetTaskList",
//                            type:"post",
//                            data:JSON.stringify(condition),
//                            dataType:"json",
//                            success:function(result){
//                                $scope.downloadList.griddata.data = result.datas;
//                                $scope.$apply();
//                            },
//                            error:function(xmlHttpRequest,textStatus){
//                                alert("请求出错!");
//                            },
//                            complete:function(xmlhHttpRequest,textStatus){
//
//                            }
//                        });
//                    },500);
                }

                $scope.getDownloadList = function(postdata){
                    $.ajax({
                        url:httpservice.serverurl + "script/Common/GetTaskList",
                        type:"post",
                        data:JSON.stringify(postdata),
                        dataType:"json",
                        success:function(result){
                            $scope.downloadList.griddata.data = result.datas;
                            $scope.$apply();
                        },
                        error:function(xmlHttpRequest,textStatus){
                            alert("请求出错!");
                        },
                        complete:function(xmlhHttpRequest,textStatus){

                        }
                    });
                }

                $(".jin1").live("click",(function(e){
                    var num = $(e.target).find("label").text();
                    $("#starttime").attr("value", dateFormat(new Date(new Date().setDate(new Date().getDate() - num)), "yyyy-MM-dd"));
                    $("#endtime").attr("value", dateFormat(new Date(new Date().setDate(new Date().getDate() - 1)), "yyyy-MM-dd"));

                    $scope.grid1.gridpagedata.nowpage = 1;
                    var condition = getCondition();
                    queryData(condition);
                }));

                $scope.query = function(){
                    if($("#starttime").val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($("#endtime").val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime").val())<new Date($("#starttime").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }
                    $scope.grid1.gridpagedata.nowpage = 1;
                    var condition = getCondition();
                    queryData(condition);
                };

                var getCondition = function(){
                    return condition={
                        starttime:$("#starttime").val(),
                        endtime:$("#endtime").val(),
                        pageindex:1,
                        pagesize:$scope.grid1.gridpagedata.pagesize,
                        ispage:true,
                        wheresql:getWhereSql()
                    };
                };

                var getWhereSql =function(){
                    var key= $scope.qjselect;
                    var minScore = $("#txtMinScore").val();
                    var maxScore = $("#txtMaxScore").val();
                    switch (key){
                        case "between":
                            return " and weight_score>="+minScore+" and weight_score <="+maxScore+"";
                        case "less":
                            return " and weight_score<"+maxScore+"";
                        case "greater":
                            return " and weight_score >"+maxScore+"";
                        default:
                            return "";
                    }
                };

                var queryData = function(condition){
                    var f =  httpservice.post("script/NetPerception/Get34GNetPerceptionData", JSON.stringify(condition), function (result) {
                        $scope.grid1.gridpagedata.totalcount = result.recordCount;
                        $scope.grid1.gridpagedata.totalpage = result.pageCount;
                        $scope.grid1.gridpagedata.startline =result.startLine;
                        $scope.grid1.gridpagedata.endline = result.endLine;
                        $scope.grid1.gridpagedata.datacount = result.dataCount;
                        $scope.grid1.griddata.data = result.datas;
                        $scope.$apply();
                    });

                    $scope.$emit('loading', 'true');
                    $scope.$apply();
                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };

                $scope.turnPage = function(){
                    var pagecondition = {
                        starttime:$("#starttime").val(),
                        endtime:$("#endtime").val(),
                        pageindex:$scope.grid1.gridpagedata.nowpage,
                        pagesize:$scope.grid1.gridpagedata.pagesize,
                        ispage:true,
                        wheresql:getWhereSql()
                    };
                    queryData(pagecondition);
                };

                //导出小时明细
                $scope.exportHourdetail = function(){
                    var condition = getCondition();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "34G感知分析";
                    var url = httpservice.serverurl + "script/NetPerception/SubmitHourDetailDownloadTask";
                    submitDownloadTask(condition,url);
                    //var requestUrl = httpservice.serverurl + "script/NetPerception/UpLoad34GNetHourFile";
//                    $.ajax({
//                        url: requestUrl,
//                        type: "POST",
//                        data: JSON.stringify(condition),
//                        dataType: "json",
//                        success: function (callback, textStatus) {
//                            result = callback;
//                            var openUrl = httpservice.serverurl + 'script/NetPerception/DownLoadFile?fileId=' + result.FileId + '&fileName=' + result.FileName; //转向网页的地址;
//                            window.open(openUrl, '_self');
//                        },
//                        error:function(){
//
//                        },
//                        complete:function(){
//
//                        }
//                    });
                };

                //导出表格所有数据
                $scope.exportData = function(){
                    var condition = getCondition();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "34G感知分析";
                    var url = httpservice.serverurl + "script/NetPerception/SubmitDayDetailDownloadTask";
                    submitDownloadTask(condition,url);

                    //var requestUrl = httpservice.serverurl + "script/NetPerception/UpLoad34GNetDayFile";

//                    $.ajax({
//                        url: requestUrl,
//                        type: "POST",
//                        data: JSON.stringify(condition),
//                        dataType: "json",
//                        success: function (callback, textStatus) {
//                            result = callback;
//                            var openUrl = httpservice.serverurl + 'script/NetPerception/DownLoadFile?fileId=' + result.FileId + '&fileName=' + result.FileName; //转向网页的地址;
//                            window.open(openUrl, '_self');
//                        },
//                        error:function(){
//
//                        },
//                        complete:function(){
//
//                        }
//                    });
                };

                //上传文件到服务器
                var UploadFile = function (postdata,requestUrl) {
                    var result = null;
                    $.ajax({
                        url: requestUrl,
                        type: "POST",
                        data: JSON.stringify(postdata),
                        dataType: "json",
                        async:false,
                        success: function (callback, textStatus) {
                            result = callback;
                        },
                        error:function(){

                        },
                        complete:function(){

                        }
                    });

                    return result;
                };

                $scope.qjselect = 'between';
                $scope.selectchange = function(e){
                    $scope.qjselect = e.qjselect;
                    if(e.qjselect != 'between'){
                        $('.hide1').hide();
                        $('.hide2').hide();
                    }else{
                        $('.hide1').show();
                        $('.hide2').show();
                    }
                };

                /*mouseover*/
                $scope.showdetailinfo = function(){
                    $scope.detailinfo = true;
                };

                $scope.hidedetailinfo = function(){
                    $scope.detailinfo = false;
                };

                $scope.init=function(){
                    $scope.$emit('loading', 'true');

                    var startDate = dateFormat(new Date(new Date().setDate(new Date().getDate()-1)), "yyyy-MM-dd");
                    var endDate = dateFormat(new Date(new Date().setDate(new Date().getDate()-1)), "yyyy-MM-dd");

                    $scope.stime = startDate;
                    $scope.etime = endDate;

                    var conditon = {
                        starttime:startDate,
                        endtime:endDate,
                        pageindex:1,
                        pagesize:$scope.grid1.gridpagedata.pagesize,
                        ispage:true,
                        wheresql:"and weight_score>=0 and weight_score<=100"
                    };

                    var f1 =  httpservice.post("script/NetPerception/Get34GNetPerceptionData", JSON.stringify(conditon), function (result) {
                        $scope.grid1.gridpagedata.totalcount = result.recordCount;
                        $scope.grid1.gridpagedata.totalpage = result.pageCount;
                        $scope.grid1.gridpagedata.startline =result.startLine;
                        $scope.grid1.gridpagedata.endline = result.endLine;
                        $scope.grid1.gridpagedata.datacount = result.dataCount;
                        $scope.grid1.griddata.data = result.datas;
                        $scope.$apply();
                    });

                    var query = "date="+dateFormat(new Date(),"yyyy-MM-dd")+"";
                    var f2 =  httpservice.getJSON("script/NetPerception/GetAllNetDataByDay", query, function (result) {
                        $scope.listValue = result.value;
                        $scope.listScore = result.score;
                    });

                    $.when(f1,f2).then(function () {
                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };

//                $scope.init();
            };

            var customCtrl = function ($scope, httpservice){
                $scope.groupNameisnotempty = function(){
                    if($("#userGroupName1").val()==""){
                        alert("用户组名不能为空");
                        $("#userGroupName1").focus();
                        return false;
                    }else{
                        return true;
                    }
                };
                $scope.checkusergroupname = function(){
                    var url =httpservice.javaserverurl+"userGroup.do?method=updateGroupNameisexit";
                    var upurl= "userGroup.do?method=editUserGroup";
                    var condition = {
                        groupid:$("#userGroupId1").val(),
                        groupname:$("#userGroupName1").val()
                    };
                    var result =false;
                    $.ajax({
                        url: url,
                        cache: false,
                        dataType: "json",
                        async: false,
                        data: condition,
                        type: 'POST',
                        success: function (data) {
                            result=data.result;
                        }
                    });
                    return result;
                };
                $scope.checkaddgroup = function(){
                    var result =false;
                    var url = httpservice.javaserverurl+"userGroup.do?method=isExit";
                    var condition={
                        groupName:$("#userGroupName").val()
                    };
                    $.ajax({
                        url: url,
                        cache: false,
                        dataType: "json",
                        async: false,
                        data: condition,
                        type: 'POST',
                        success: function (data) {
                            result=data.result;
                        }
                    });
                    return result;
                };
                $scope.checkfile = function(){
                    var fileName = $("#userGroupFile").val();
                    var ext = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
                    if(ext==".xls"){
                        return true;
                    }else{
                        return false;
                    }
                };
                $scope.addUserGroup = function(){
                    var formData = new FormData();
                    formData.append("userGroupName", $("#userGroupName").val());
                    formData.append("userGroupDes", $("#userGroupDes").val());
                    formData.append("userGroupFile", $("#userGroupFile")[0].files[0]);
                    var serviceurl = "userGroup.do?method=addUserGroup";
                    var url = httpservice.javaserverurl + serviceurl;
                    $.ajax({
                        url: url,
                        cache: false,
                        data: formData,
                        processData: false,
                        contentType: false,
                        type: 'POST',
                        success: function (data) {
                            alert(data.result);
                            // $scope.clearall();
                            $scope.getUserGroup(getCondition());
                        }
                    });
                };
                $scope.clearall = function(){
                    $("#groupName").val("");
                    $("#userGroupName").val("");
                    $("#userGroupDes").val("");
                    $("#userGroupFile").val("");
                };
                $scope.downloadPhoneModel = function(){
                    var modelUrl = "userGroup.do?method=downloadmodel";
                    var url = httpservice.javaserverurl+modelUrl;
                    window.open(url);
                };
                $scope.showuser = function(){
                    $scope.clearall();
                    $("#userGroupName").focus();
                    $scope.addGroup1.show();
                };
                $scope.turnPage1= function(){
                    $scope.getUserGroup(getCondition());
                };
                $scope.query1 = function(condition){
                    $scope.getUserGroup(getCondition());
                    clearall();
                };
                $scope.updateUser = function(url,condition){
                    httpservice.javaPost(url,condition,function(result){
                        $scope.getUserGroup(getCondition());
                        alert(result.result);
                    });
                };
                $scope.getusercondition = function(){
                    condition={
                        usergroupid:$("#userGroupId1").val(),
                        usergroupname:$("#userGroupName1").val(),
                        usergroupdes:$("#userGroupDes1").val()
                    };
                    return condition;
                };
                $scope.editUserGroup = {
                    title: "编辑用户群组",
                    show: function () {
                    },
                    ok: function () {
                        if($scope.groupNameisnotempty()){
                            var re=$scope.checkusergroupname();
                            if(re){
                                $("#userGroupName1").focus();
                                alert("用户组名已经存在，请勿重复");
                                return false;
                            }else{
                                $scope.updateUser("userGroup.do?method=editUserGroup",$scope.getusercondition());
                            }
                        }else{
                            $("#userGroupName1").focus();
                            return false;
                        }
                    },
                    cancel: function () {}
                };
                $scope.addGroup1 = {
                    title: "新增用户组",
                    show: function () {
                    },
                    ok: function () {
                        if($("#userGroupName").val()!=""){
                            var re = $scope.checkaddgroup();
                            if(re){
                                alert("用户组名已经存在");
                                $("#userGroupName").focus();
                                return false;
                            }else{
                                if($("#userGroupFile").val()!=""){
                                    var extiscorrect=$scope.checkfile();
                                    if(extiscorrect){
                                        $scope.addUserGroup();
                                    }else{
                                        $("#userGroupFile").val("");
                                        $("#userGroupFile").focus();
                                        alert("文件格式错误");
                                        return false;
                                    }
                                }else{
                                    $("#userGroupFile").focus();
                                    alert("请上传文件");
                                    return false;
                                }
                            }
                        }else{
                            $("#userGroupName").focus();
                            alert("用户组名不能为空");
                            return false;
                        }
                    },
                    cancel: function () {}
                };
                $scope.addGroup2 = {
                    title: "新增小区组",
                    //                    show: function () { },
                    ok: function () {},
                    cancel: function () {}
                };
                $scope.addGroup3 = {
                    title: "新增终端组",
                    //                    show: function () { },
                    ok: function () {},
                    cancel: function () {}
                };
                var operate = function(cellvalue, options, rowObject){
                    var listprint = "<a class='editorgroup editUserGroup' href='javascript:' userGroup-id='"+rowObject.id+"' userGroup-name='"+rowObject.groupname+"' userGroup-des='"+rowObject.groupdes+"'' title='编辑'><img src='../../../images/bianji.png' /></a>"+
                        "<a class='deleteUserGroup' style='margin-left: 30px;' href='javascript:' userGroup-id='"+rowObject.id+"' userGroup-name='"+rowObject.groupname+"' title='删除'><img src='../../../images/delete1.png' /></a>";
                    return listprint;
                };
                var operate2 = function(cellvalue, options, rowObject){
                    var listprint = "<a class='editorgroup editCommGroup'  href='javascript:' community_group_id='"+rowObject.community_group_id+"' community_group_name='"+rowObject.community_group_name+"' net_type='"+rowObject.net_type+"' community_group_description='"+rowObject.community_group_description+"' title='编辑'><img src='../../../images/bianji.png' /></a>"+
                        "<a class='deleteCommGroup' style='margin-left: 30px;'  href='javascript:' community_group_id='"+rowObject.community_group_id+"' community_group_name='"+rowObject.community_group_name+"' net_type='"+rowObject.net_type+"' community_group_description='"+rowObject.community_group_description+"' title='删除'><img src='../../../images/delete1.png' /></a>";
                    return listprint;
                };
                var operate3 = function(cellvalue, options, rowObject){
                    var listprint = "<a class='editorgroup editTerGroup'  href='javascript:' terminal_group_id='"+rowObject.terminal_group_id+"' terminal_group_name='"+rowObject.terminal_group_name+"'  terminal_group_des='"+rowObject.terminal_group_des+"' title='编辑'><img src='../../../images/bianji.png' /></a>"+
                        "<a class='deleteTerGroup' style='margin-left: 30px;' href='javascript:' terminal_group_id='"+rowObject.terminal_group_id+"' terminal_group_name='"+rowObject.terminal_group_name+"'  terminal_group_des='"+rowObject.terminal_group_des+"' title='删除'><img src='../../../images/delete1.png' /></a>";
                    return listprint;
                };
                //获取编辑用户的数据
                var geteditUsergroupdata = function(e){
                    $("#userGroupId1").val($(e).attr("userGroup-id"));
                    $("#userGroupName1").val($(e).attr("userGroup-name"));
                    $("#userGroupDes1").val($(e).attr("userGroup-des"));
                    groupName = $("#userGroupId1").val();
                };
                //编辑用户组
                $('.editUserGroup').live("click",function(){
                    geteditUsergroupdata(this);
                    $scope.editUserGroup.show();
                    $("#userGroupName1").focus();
                });
                //删除用户组
                $('.deleteUserGroup').live("click",function(){
                    var usergroupname =$(this).attr("userGroup-name");
                    var condition = {
                        groupId:$(this).attr("userGroup-id")
                    };
                    if(confirm("是否删除用户组"+usergroupname)){
                        httpservice.javaPost("userGroup.do?method=removeUserGroup",condition,function(result){
                            $scope.getUserGroup(getCondition());
                            alert(result.result);
                        });
                    }
                });
                $scope.grid1 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['id','序号','群组名称','描述','号码个数','创建用户',"创建时间","操作"],
                        colmodel: [
                            { name: 'id', index: 'id', sortable: false, sorttype: 'number', align:"center",hidden:true},
                            { name: 'number', index: 'number', sortable: false, align:"center"},
                            { name: 'groupname', index: 'groupname', sortable: false, align:"center"},
                            { name: 'groupdes', index: 'groupdes', sortable: false, align:"center"},
                            { name: 'phonenum', index: 'phonenum', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'user', index: 'user', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'creationdate', index: 'creationdate', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'operation', index: 'operation', sortable: true, sorttype: 'number', align:"center",formatter:operate}
                        ],
                        data: [
//                            { "number": "1", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "2", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "3", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "4", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "5", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "6", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "7", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "8", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "9", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"},
//                            { "number": "10", "groupname": "XXX", "groupdes": "XXX", "phonenum": "1000", "user": "XXX", "creationdate": "2015-9-3"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width());
                        grid.setGridHeight(300);
                    }
                };
                var getCondition= function(){
                    var condition = {
                        groupName:$("#groupName").val(),
                        nowpage:$scope.grid1.gridpagedata.nowpage,
                        pagesize:$scope.grid1.gridpagedata.pagesize
                    };
                    return condition;
                };
                $scope.getUserGroup = function(condition){
                    $scope.$emit('loading', 'true');
                    var url="userGroup.do";
                    var getusergroup= httpservice.javaPost(url,getCondition(),function(result){
                        $scope.grid1.gridpagedata.totalcount = result.recordCount;
                        $scope.grid1.gridpagedata.totalpage = result.pageCount;
                        $scope.grid1.gridpagedata.startline =result.startLine;
                        $scope.grid1.gridpagedata.endline = result.endLine;
                        $scope.grid1.gridpagedata.datacount = result.dataCount;
                        $scope.grid1.griddata.data = result.datas;
                        $scope.$apply();
                    });
                    $.when(getusergroup).then(function () {
                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                var query = function(){
                    var condition = {
                        groupName:$("#groupName").val(),
                        nowpage:$scope.grid1.gridpagedata.nowpage,
                        pagesize:$scope.grid1.gridpagedata.pagesize};
                    $scope.getUserGroup(condition);
                };
                $scope.getUserGroup(getCondition());
                $scope.grid2 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid2.gridpagedata.nowpage = 1;
                            $scope.turnPage2();
                        },
                        toToppage: function(){
                            if($scope.grid2.gridpagedata.nowpage>1){
                                $scope.grid2.gridpagedata.nowpage--;
                            }
                            $scope.turnPage2();
                        },
                        toNextpage: function(){
                            if($scope.grid2.gridpagedata.nowpage<$scope.grid2.gridpagedata.totalpage){
                                $scope.grid2.gridpagedata.nowpage++;
                            }
                            $scope.turnPage2();
                        },
                        toLastpage: function(){
                            $scope.grid2.gridpagedata.nowpage = $scope.grid2.gridpagedata.totalpage;
                            $scope.turnPage2();
                        },
                        topage: function(){
                            if($scope.grid2.gridpagedata.nowpage<1){
                                $scope.grid2.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid2.gridpagedata.nowpage>$scope.grid2.gridpagedata.totalpage){
                                $scope.grid2.gridpagedata.nowpage = $scope.grid2.gridpagedata.totalpage;
                            }
                            $scope.turnPage2();
                        },
                        changePagesize: function(){
                            $scope.grid2.gridpagedata.nowpage = 1;
                            $scope.turnPage2();
                        }
                    },
                    griddata: {
                        colnames: ['序号','id','群组名称','网络类型','描述','小区数','创建用户',"创建时间","操作"],
                        colmodel: [
                            { name: 'number', index: 'number', sortable: false, align:"center"},
                            { name: 'community_group_id', index: 'community_group_id', sortable: false, align:"center",hidden:true},
                            { name: 'community_group_name', index: 'community_group_name', sortable: false, align:"center"},
                            { name: 'net_type', index: 'net_type', sortable: false, align:"center",hidden:true},
                            { name: 'community_group_description', index: 'community_group_description', sortable: false, align:"center"},
                            { name: 'community_number', index: 'community_number', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'creator', index: 'creator', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'create_time', index: 'create_time', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'operation', index: 'operation', sortable: true, sorttype: 'number', align:"center",formatter:operate2}
                        ],
                        data: [
//                            {"number": "1", "community_group_id": "1", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "2", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "3", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "4", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "5", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "6", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "7", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "8", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "9", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            {"number": "1", "community_group_id": "10", "community_group_name": "XXX","net_type": "XXX", "community_group_description": "XXX", "community_number": "1000", "creator": "XXX", "create_time": "2015-9-3"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width());
                        grid.setGridHeight(300);
                    }
                };
                $scope.grid3 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid3.gridpagedata.nowpage = 1;
                            $scope.turnPage3();
                        },
                        toToppage: function(){
                            if($scope.grid3.gridpagedata.nowpage>1){
                                $scope.grid3.gridpagedata.nowpage--;
                            }
                            $scope.turnPage3();
                        },
                        toNextpage: function(){
                            if($scope.grid3.gridpagedata.nowpage<$scope.grid3.gridpagedata.totalpage){
                                $scope.grid3.gridpagedata.nowpage++;
                            }
                            $scope.turnPage3();
                        },
                        toLastpage: function(){
                            $scope.grid3.gridpagedata.nowpage = $scope.grid3.gridpagedata.totalpage;
                            $scope.turnPage3();
                        },
                        topage: function(){
                            if($scope.grid3.gridpagedata.nowpage<1){
                                $scope.grid3.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid3.gridpagedata.nowpage>$scope.grid3.gridpagedata.totalpage){
                                $scope.grid3.gridpagedata.nowpage = $scope.grid3.gridpagedata.totalpage;
                            }
                            $scope.turnPage3();
                        },
                        changePagesize: function(){
                            $scope.grid3.gridpagedata.nowpage = 1;
                            $scope.turnPage3();
                        }
                    },
                    griddata: {
                        colnames: ['序号','id','群组名称','描述','终端(TCA)数','创建用户',"创建时间","操作"],
                        colmodel: [
                            { name: 'number', index: 'number', sortable: false, align:"center"},
                            { name: 'terminal_group_id', index: 'terminal_group_id', sortable: false, align:"center",hidden:true},
                            { name: 'terminal_group_name', index: 'terminal_group_name', sortable: false, align:"center"},
                            { name: 'terminal_group_des', index: 'terminal_group_des', sortable: false, align:"center"},
                            { name: 'terminal_num', index: 'terminal_num', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'creator', index: 'creator', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'create_time', index: 'create_time', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'operation', index: 'operation', sortable: true, sorttype: 'number', align:"center",formatter:operate3}
                        ],
                        data: [
//                            { "number": "1","terminal_group_id": "1", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "2","terminal_group_id": "2", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "3","terminal_group_id": "3", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "4", "terminal_group_id": "4", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "5", "terminal_group_id": "5", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "6","terminal_group_id": "6", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "7","terminal_group_id": "7", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "8","terminal_group_id": "8", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "9","terminal_group_id": "9", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"},
//                            { "number": "10","terminal_group_id": "10", "terminal_group_name": "XXX", "terminal_group_des": "XXX", "terminal_num": "1000", "creator": "XXX", "create_time": "2015-9-3"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width());
                        grid.setGridHeight(300);
                    }
                };
                //小区组 start------------

                //小区组模板下载
                $scope.commExcelModel =  function(){
                    window.open(httpservice.javaserverurl+"communityGroup.do?method=commExcelModel");
                };

                //获得小区组的新增/编辑表单数据
                var getCommFormData = function(){
                    var formData = new FormData();
                    formData.append("community_group_id",$("#community_group_id").val());
                    formData.append("community_group_name",$("#commGroupName").val());
                    formData.append("community_group_description",$("#commGroupDes").val());
                    formData.append("net_type",$("#net_type").val());
                    formData.append("commGroupUpload",$("#commGroupUpload")[0].files[0]);
                    return formData;
                };
                //获得所编辑的小区组记录表单数据
                var getRowData = function(e){
                    $("#commGroupName").val($(e).attr("community_group_name"));
                    $("#commGroupDes").val($(e).attr("community_group_description"))
                    $("#net_type").val($(e).attr("net_type"))
                    $("#community_group_id").val($(e).attr("community_group_id"))
                };
                //清空小区组的表单数据
                var clearComm = function(){
                    $("#commGroupName").val("");
                    $("#commGroupDes").val("")
                    $("#net_type").val("")
                    $("#commGroupUpload").val("")
                    $("#community_group_id").val("")
                    $("#commErrorinfo").html("");
                };
                //验证小区组名是否存在
                var isCommGroupNameExist = function(){
                    var condition={
                        commGroupName:$("#commGroupName").val()
                    };
                    var is=httpservice.javaPost("communityGroup.do?method=isCommExist",condition, function (result) {
                        if(result == 1){
                            $("#commErrorinfo").html("");
                            isCommExist = false;
                        }else if(result == 0){
                            $('#commGroupName').focus();
                            $("#commErrorinfo").html("<font color=\"red\">群组名已存在！</font>");
                            isCommExist = true;
                        }else{
                            $('#commGroupName').focus();
                            $("#commErrorinfo").html("<font color=\"red\">请输入群组名！</font>");
                            isCommExist = true;
                        }
                    });
                };
                //小区组输入 检查
                $('#commGroupName').live("input",function(){
                    isCommGroupNameExist();
                });
                //新增小区组 群组
                $scope.addCommGroup = function(){
                    clearComm();
                    $("#commGroupUpload").css("display","block");
                    $scope.addGroup2.title = "新增小区组";
                    $scope.addGroup2.show();
                    $scope.addGroup2.ok = function (){
                        if($("#commGroupName").val() !=''){
                            if(!isCommExist){
                                if($("#commGroupUpload").val() !=''){
                                    if($("#commGroupUpload").val().substring($("#commGroupUpload").val().lastIndexOf(".")).toLowerCase() =='.xls'){
                                        $.ajax({
                                            url:httpservice.javaserverurl+"communityGroup.do?method=addCommunityGroup",
                                            cache: false,
                                            data: getCommFormData(),
                                            processData: false,
                                            contentType: false,
                                            type: 'POST',
                                            success: function(result){
                                                alert("新增成功");
                                                getCommGroup();
                                            },
                                            error:function(result){
                                                alert("新增失败");
                                                getCommGroup();
                                            }
                                        });
                                    }else{
                                        $("#commErrorinfo").html("<font color=\"red\">上传文件格式为.xls</font>");
                                        return false;
                                    }
                                }else{
                                    $("#commErrorinfo").html("<font color=\"red\">请上传文件</font>");
                                    return false;
                                }
                            } else{
                                $("#commErrorinfo").html("<font color=\"red\">群组名已存在</font>");
                                return false;
                            }
                        }else{
                            $("#commErrorinfo").html("<font color=\"red\">群组名不能为空</font>");
                            return false;
                        }
                    }
                };
                //编辑小区组 群组
                $('.editCommGroup').live("click",function(){
                    clearComm();
                    getRowData(this);
                    $("#commGroupUpload").css("display","none");
                    $scope.addGroup2.title = "编辑小区组";
                    $scope.addGroup2.show();
                    $scope.addGroup2.ok = function (){
                        if($("#commGroupName").val() !=''){
                            if(!isCommExist){
                                $.ajax({
                                    url:httpservice.javaserverurl+"communityGroup.do?method=updateComm",
                                    cache: false,
                                    data: getCommFormData(),
                                    processData: false,
                                    contentType: false,
                                    type: 'POST',
                                    success: function(result){
                                        alert("编辑成功");
                                        getCommGroup();
                                    },
                                    error:function(result){
                                        alert("编辑失败");
                                        getCommGroup();
                                    }
                                });
                            } else{
                                $("#commErrorinfo").html("<font color=\"red\">群组名已存在</font>");
                                return false;
                            }
                        }else{
                            $("#commErrorinfo").html("<font color=\"red\">群组名不能为空</font>");
                            return false;
                        }
                    }
                });
                //删除小区组记录
                $('.deleteCommGroup').live("click",function(){
                    var commid=$(this).attr('community_group_id');
                    var condition={
                        id:commid
                    };
                    /* clearComm();
                     getRowData(this);
                     $("#commGroupUpload").css("display","none");
                     $scope.addGroup2.title = "删除小区组";
                     $scope.addGroup2.show();
                     $scope.addGroup2.ok = function (){
                     var deleterole=httpservice.javaPost("communityGroup.do?method=deleteComm",condition, function (result) {
                     if(result == 0){
                     alert("删除成功");
                     }else{
                     alert("删除失败");
                     }

                     });
                     $.when(deleterole).then(function () {
                     }).always(function () {
                     getCommGroup();
                     });
                     }*/
                    if(confirm("确定删除 "+$(this).attr('community_group_name')+" 组")){
                        var deleterole=httpservice.javaPost("communityGroup.do?method=deleteComm",condition, function (result) {
                            if(result == 0){
                                alert("删除成功");
                            }else{
                                alert("删除失败");
                            }
                        });
                        $.when(deleterole).then(function () {
                        }).always(function () {
                                getCommGroup();
                            });
                    }
                });
                //获得小区组的数据
                var getCommGroup = function(){
                    $scope.$emit('loading', 'true');
                    var comGroupCondition = {
                        community_group_name:$("#community_group_name").val(),
                        pageindex:$scope.grid2.gridpagedata.nowpage,
                        pagesize:$scope.grid2.gridpagedata.pagesize
                    };
                    var getC= httpservice.javaPost("communityGroup.do?method=showgrid",comGroupCondition,function(result){
                        $scope.grid2.gridpagedata.totalcount = result.recordCount;
                        $scope.grid2.gridpagedata.totalpage = result.totalPage;
                        $scope.grid2.gridpagedata.startline =result.startLine;
                        $scope.grid2.gridpagedata.endline = result.endLine;
                        $scope.grid2.gridpagedata.datacount = result.dataCount;
                        Date.prototype.Format = function (fmt) { //author: meizz
                            var o = {
                                "M+": this.getMonth() + 1, //月份
                                "d+": this.getDate(), //日
                                "h+": this.getHours(), //小时
                                "m+": this.getMinutes(), //分
                                "s+": this.getSeconds(), //秒
                                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                                "S": this.getMilliseconds() //毫秒
                            };
                            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
                            for (var k in o)
                                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                            return fmt;
                        };
                        for(var i = 0;i<result.datas.length;i++){
                            result.datas[i].create_time = new Date(result.datas[i].create_time).Format("yyyy-MM-dd hh:mm:ss");
                        }
                        $scope.grid2.griddata.data = result.datas;
                        $scope.$apply();

                    });

                    $.when(getC).then(function () {
                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });

                };
                //小区组 end------------
                //终端组 start-------------

                //终端组模板下载
                $scope.terExcelModel =  function(){
                    window.open(httpservice.javaserverurl+"terminalGroup.do?method=terExcelModel");
                };

                //获得终端组的新增/编辑表单数据
                var getTerFormData = function(){
                    var formData = new FormData();
                    formData.append("terminal_group_id",$("#terminal_group_id").val());
                    formData.append("terminal_group_name",$("#terGroupName").val());
                    formData.append("terminal_group_des",$("#terGroupDes").val());
                    formData.append("terGroupUpload",$("#terGroupUpload")[0].files[0]);
                    return formData;
                };
                //获得所编辑的终端组记录表单数据
                var getRowData2 = function(e){
                    $("#terGroupName").val($(e).attr("terminal_group_name"));
                    $("#terGroupDes").val($(e).attr("terminal_group_des"));
                    $("#terminal_group_id").val($(e).attr("terminal_group_id"))
                };
                //清空终端组的表单数据
                var clearTer = function(){
                    $("#terGroupName").val("");
                    $("#terGroupDes").val("");
                    $("#terGroupUpload").val("");
                    $("#terminal_group_id").val("");
                    $("#terErrorinfo").html("");
                };
                //验证终端组名是否存在
                var isTerGroupNameExist = function(){
                    var condition={
                        terGroupName:$("#terGroupName").val()
                    };
                    var is=httpservice.javaPost("terminalGroup.do?method=isTerExist",condition, function (result) {
                        if(result == 1){
                            $("#terErrorinfo").html("");
                            isTerExist = false;
                        }else if(result == 0){
                            $('#terGroupName').focus();
                            $("#terErrorinfo").html("<font color=\"red\">群组名已存在！</font>");
                            isTerExist = true;
                        }else{
                            $('#terGroupName').focus();
                            $("#terErrorinfo").html("<font color=\"red\">请输入群组名！</font>");
                            isTerExist = true;
                        }
                    });
                };
                //终端组输入 检查
                $('#terGroupName').live("input",function(){
                    isTerGroupNameExist();
                });
                //新增终端组 群组
                $scope.addTerGroup = function(){
                    clearTer();
                    $("#terGroupUpload").css("display","block");
                    $scope.addGroup3.title = "新增终端组";
                    $scope.addGroup3.show();
                    $scope.addGroup3.ok = function (){
                        if($("#terGroupName").val() !=''){
                            if(!isTerExist){
                                if($("#terGroupUpload").val() !=''){
                                    if($("#terGroupUpload").val().substring($("#terGroupUpload").val().lastIndexOf(".")).toLowerCase() =='.xls'){
                                        $.ajax({
                                            url:httpservice.javaserverurl+"terminalGroup.do?method=addTerminalGroup",
                                            cache: false,
                                            data: getTerFormData(),
                                            processData: false,
                                            contentType: false,
                                            type: 'POST',
                                            success: function(result){
                                                alert("新增成功");
                                                getTerGroup();
                                            },
                                            error:function(result){
                                                alert("新增失败");
                                                getTerGroup();
                                            }
                                        });
                                    }else{
                                        $("#terErrorinfo").html("<font color=\"red\">上传文件格式为.xls</font>");
                                        return false;
                                    }
                                }else{
                                    $("#terErrorinfo").html("<font color=\"red\">请上传文件</font>");
                                    return false;
                                }
                            } else{
                                $("#terErrorinfo").html("<font color=\"red\">群组名已存在</font>");
                                return false;
                            }
                        }else{
                            $("#terErrorinfo").html("<font color=\"red\">群组名不能为空</font>");
                            return false;
                        }
                    }
                };
                //编辑终端组 群组
                $('.editTerGroup').live("click",function(){
                    clearTer();
                    getRowData2(this);
                    $("#terGroupUpload").css("display","none");
                    $scope.addGroup3.title = "编辑终端组";
                    $scope.addGroup3.show();
                    $scope.addGroup3.ok = function (){
                        if($("#terGroupName").val() !=''){
                            if(!isTerExist){
                                $.ajax({
                                    url:httpservice.javaserverurl+"terminalGroup.do?method=updateTer",
                                    cache: false,
                                    data: getTerFormData(),
                                    processData: false,
                                    contentType: false,
                                    type: 'POST',
                                    success: function(result){
                                        alert("编辑成功");
                                        getTerGroup();
                                    },
                                    error:function(result){
                                        alert("编辑失败");
                                        getTerGroup();
                                    }
                                });
                            } else{
                                $("#terErrorinfo").html("<font color=\"red\">群组名已存在</font>");
                                return false;
                            }
                        }else{
                            $("#terErrorinfo").html("<font color=\"red\">群组名不能为空</font>");
                            return false;
                        }
                    }
                });
                //删除终端组
                $('.deleteTerGroup').live("click",function(){
                    var terid=$(this).attr('terminal_group_id');
                    var condition={
                        id:terid
                    };
                    /* clearTer();
                     getRowData2(this);
                     $("#terGroupUpload").css("display","none")
                     $scope.addGroup3.title = "删除终端组";
                     $scope.addGroup3.show();
                     $scope.addGroup3.ok = function (){
                     var deleterole=httpservice.javaPost("terminalGroup.do?method=deleteTer",condition, function (result) {
                     if(result == 0){
                     alert("删除成功");
                     }else{
                     alert("删除失败");
                     }

                     });
                     $.when(deleterole).then(function () {
                     }).always(function () {
                     getTerGroup();
                     });
                     }*/
                    if(confirm("确定删除 "+$(this).attr('terminal_group_name')+" 组")){
                        var deleterole=httpservice.javaPost("terminalGroup.do?method=deleteTer",condition, function (result) {
                            if(result == 0){
                                alert("删除成功");
                            }else{
                                alert("删除失败");
                            }
                        });
                        $.when(deleterole).then(function () {
                        }).always(function () {
                                getTerGroup();
                            });
                    }
                });
                //获得终端组的数据
                var getTerGroup = function(){
                    $scope.$emit('loading', 'true');
                    var terGroupCondition = {
                        terminal_group_name:$("#terminal_group_name").val(),
                        pageindex:$scope.grid3.gridpagedata.nowpage,
                        pagesize:$scope.grid3.gridpagedata.pagesize
                    };
                    var getT = httpservice.javaPost("terminalGroup.do?method=showgrid",terGroupCondition,function(result){
                        $scope.grid3.gridpagedata.totalcount = result.recordCount;
                        $scope.grid3.gridpagedata.totalpage = result.totalPage;
                        $scope.grid3.gridpagedata.startline =result.startLine;
                        $scope.grid3.gridpagedata.endline = result.endLine;
                        $scope.grid3.gridpagedata.datacount = result.dataCount;
                        Date.prototype.Format = function (fmt) { //author: meizz
                            var o = {
                                "M+": this.getMonth() + 1, //月份
                                "d+": this.getDate(), //日
                                "h+": this.getHours(), //小时
                                "m+": this.getMinutes(), //分
                                "s+": this.getSeconds(), //秒
                                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                                "S": this.getMilliseconds() //毫秒
                            };
                            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
                            for (var k in o)
                                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                            return fmt;
                        };
                        for(var i = 0;i<result.datas.length;i++){
                            result.datas[i].create_time = new Date(result.datas[i].create_time).Format("yyyy-MM-dd hh:mm:ss");
                        }
                        $scope.grid3.griddata.data = result.datas;
                        $scope.$apply();
                    });

                    $.when(getT).then(function () {
                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });


                };
                //初始化
                $scope.init = function (){
                    $scope.$emit('loading', 'true');
                    var f1 = getCommGroup();
                    var f2 = getTerGroup();
                    $.when(f1,f2).then(function(){
                    }).always(function(){
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                $scope.init();
                //小区组查询
                $scope.queryComm = function(){
                    $scope.grid2.gridpagedata.nowpage = 1;
                    $scope.grid2.gridpagedata.pagesize = 20;
                    $scope.$apply();
                    getCommGroup();
                };
                $scope.turnPage2 = function(){
                    getCommGroup();
                };
                //终端组查询
                $scope.queryTer = function(){
                    $scope.grid3.gridpagedata.nowpage = 1;
                    $scope.grid3.gridpagedata.pagesize = 20;
                    $scope.$apply();
                    getTerGroup();
                };
                $scope.turnPage3 = function(){
                    getTerGroup();
                };
            };

            var networkCtrl = function ($scope, httpservice){
                //删除下载文件
                $(".deletemodel").live("click",function(e){
                    var fileId = $(e.target).parent().attr("id");
                    if(confirm('你确定要删除该文件?')){
                        $.ajax({
                            url:httpservice.serverurl + "script/Common/DeleteTask",
                            type:"get",
                            data:{id:fileId},
                            dataType:"json",
                            success:function(result){
                                if(result.state){
                                    var condition = {
                                        mainmodule:"上网感知分析",
                                        submodule:"网络质量分析"
                                    }
                                    $scope.getDownloadList(condition);
                                    alert('删除成功!');
                                }
                                else{
                                    alert('删除失败!');
                                }
                            },
                            error:function(xmlHttpRequest,textStatus){
                                alert('请求出错!');
                            },
                            complete:function(xmlHttpRequest,textStatus){

                            }
                        });
                    }
                })
                var downloadoperate = function(cellvalue, options, rowObject){
                    var listprint = "<a class='viewmodel' href='javascript:'id='"+rowObject.id+"' title = '查看'><img src='../../../images/chakan.png' /></a>" +
                        "<a class='downloadmodel' style='margin: 0 15px;' href= '"+httpservice.downloadurl+""+rowObject.filename+".csv' target='_blank' id='"+rowObject.id+"' state='"+rowObject.status+"' title='下载'><img src='../../../images/download.png' /></a>" +
                        "<a class='deletemodel' href='javascript:' id='"+rowObject.id+"' state='"+rowObject.state+"' title='删除'><img src='../../../images/delete1.png' /></a>";
                    return listprint;
                };

                $scope.selectInterfaces = [
                    {value:"S1",name:"S1"}
                ];
                $scope.selectSizes = [
                    {value:"fivemin",name:"5分钟"},
                    {value:"fifteenmin",name:"15分钟"},
                    {value:"hour",name:"1小时"}
                ];
                $scope.selecttimeSizes = [
                    {value:"fifteenmin",name:"15分钟"},
                    {value:"hour",name:"小时"},
                    {value:"day",name:"天"}
                ];

                $scope.interface = $scope.selectInterfaces[0];
                $scope.size = $scope.selectSizes[0];
                $scope.timesize = $scope.selecttimeSizes[0];
                $scope.selectInterface=function(e){
                    $scope.interface = e.interface;
                };
                $scope.selectSize=function(e){
                    $scope.size = e.size;
                };
                $scope.selecttimeSize=function(e){
                    $scope.timesize = e.timesize;
                };
                $scope.selecttimeSize = function(time){
                    var pram = time.timesize;
                    $scope.timesize = pram;
                    if (pram.value == "day") {
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                    }
                    else {
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                    }
                };
                $scope.netgroup = 'mme_sgw';
                $scope.netName = 'MME';
                var getCondition1 = function(){
                    return {
                        ispage:true,
                        pageindex:$scope.grid1.gridpagedata.nowpage,
                        pagesize:$scope.grid1.gridpagedata.pagesize,
                        interface:$scope.interface.value,
                        starttime:$('#starttime1').val(),
                        endtime:$('#endtime1').val(),
                        isbusy:$('#isbusy').is(':checked'),
                        timesize:$scope.size.value
                    };
                };
                var getCondition2 = function(){
                    return {
                        interface:$('#interface2 option:selected').val(),
                        starttime:$('#starttime2').val(),
                        endtime:$('#endtime2').val(),
                        timesize:$scope.timesize.value,
                        eventtype:$('#selectEventType option:selected').val(),
                        netgroup:$scope.netgroup
                    };
                };
                $scope.btnSearch1 = function (){
                    if($('#starttime1').val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($('#endtime1').val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime1").val())<new Date($("#starttime1").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }

                    $scope.queryData1();
                };
                $scope.btnSearch2 = function (){
                    if($('#starttime2').val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($('#endtime2').val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime2").val())<new Date($("#starttime2").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }

                    var startTime = new Date($("#starttime2").val());
                    var endTime = new Date($("#endtime2").val());

                    var size = $scope.timesize.value;
                    switch(size){
                        case 'day':
                            if(getTimeDiffValue(endTime,startTime,'day')>7){
                                alert('时间范围不能超过7天!');
                                return false;
                            }
                            break;
                        case 'hour':
                            if(getTimeDiffValue(endTime,startTime,'hour')>24){
                                alert('时间范围不能超过24个小时!');
                                return false;
                            }
                            break;
                        case 'fifteenmin':
                            if(getTimeDiffValue(endTime,startTime,'hour')>5){
                                alert('时间范围不能超过5个小时!');
                                return false;
                            }
                            break;
                        default:
                            break;
                    }

                    $scope.queryData2();
                };
                $scope.queryData1 = function(){

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var condition = getCondition1();

                    var f = getNetWorkIndicatorsList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                $scope.queryData2 = function(){

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var condition = getCondition2();

                    var f1 = getNetWorkFaultTrend(condition);
                    var f2 = getNetWorkFaultReasonClass(condition);
                    var f3 = getNetWorkGroupList(condition);
                    var f4 = getNetWorkFaultReasonDetailList(condition);

                    $.when(f1,f2,f3,f4).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                //导出网络指标所有数据
                $scope.exportNetWorkIndicatorData = function(){
                    var condition = getCondition1();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "网络质量分析";
                    condition.appname = "指标分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitNetWorkIndicatorsDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                //导出网络故障原因详细所有数据
                $scope.exportNetWorkFaultReasonDetailData = function(){
                    var condition = getCondition2();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "网络质量分析";
                    condition.appname = "故障分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitNetWorkFaultReasonDetailDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                //导出网元分组数据
                $scope.exportNetWorkGroupData = function(){
                    var condition = getCondition2();
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitNetWorkGroupDownloadTask";
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "网络质量分析";
                    condition.appname = "故障分析";

                    submitDownloadTask(condition,requestUrl);
                };

                var getNetWorkIndicatorsList = function(postdata){
                    return httpservice.post("script/NetPerception/GetNetWorkIndicatorsList",JSON.stringify(postdata),function(result){
                        $scope.grid1.gridpagedata.totalcount = result.recordCount;
                        $scope.grid1.gridpagedata.totalpage = result.pageCount;
                        $scope.grid1.gridpagedata.startline = result.startLine;
                        $scope.grid1.gridpagedata.endline = result.endLine;
                        $scope.grid1.gridpagedata.datacount = result.dataCount;
                        $scope.grid1.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                var getNetWorkFaultTrend = function(postdata){
                    return httpservice.post("script/NetPerception/GetNetWorkFaultTrend",JSON.stringify(postdata),function(result){
                        var title = $('#selectEventType option:selected').text()+"指标趋势";
                        var data1 = result[0].y1Series.values,
                            data2 = result[1].y1Series.values;
                        var series0=
                        {
                            name: '请求次数',
                            color: '#4572A7',
                            type: 'spline',
                            data: data1,
                            tooltip: {
                                valueSuffix: '次'
                            }
                        };
                        var series1=
                        {
                            name: '成功率',
                            color: '#89A54E',
                            type: 'spline',
                            yAxis: 1,
                            data: data2,
                            tooltip: {
                                valueSuffix: '%'
                            }
                        };
                        $scope.highchartyy.chartdata.series = [];
                        if(data1.length>0||data2.length>0){
                            $scope.highchartyy.chartdata.series = [series0,series1];
                        }

                        $scope.highchartyy.chartdata.title.text = title;
                        $scope.highchartyy.chartdata.xAxis.categories = result[0].xSeries;

                        $scope.$apply();
                    });
                };
                var getNetWorkFaultReasonClass = function(postdata){
                    return httpservice.post("script/NetPerception/GetNetWorkFaultReasonClass",JSON.stringify(postdata),function(result){
                        var title = $('#selectEventType option:selected').text()+"故障原因归类分布";
                        var netData = result[0].y1Series.values,
                            userData = result[1].y1Series.values;
                        var series0=
                        {
                            name: '网络原因',
                            data: netData

                        };
                        var series1=
                        {
                            name: '用户原因',
                            data: userData

                        };
                        $scope.highchartcolumn.chartdata.series = [];
                        if(netData.length>0||userData.length>0){
                            $scope.highchartcolumn.chartdata.series = [series0,series1];
                        }

                        $scope.highchartcolumn.chartdata.title.text = title;
                        $scope.highchartcolumn.chartdata.xAxis.categories=result[0].xSeries;

                        $scope.$apply();
                    });
                };
                var getNetWorkFaultReasonDetailList = function(postdata){
                    return httpservice.post("script/NetPerception/GetNetWorkFaultReasonDetailList",JSON.stringify(postdata),function(result){
                        var classData = [],detailData = [];
                        for(var i=0;i<result.faultClass.length;i++){
                            var item = {};
                            item.name = result.faultClass[i].class;
                            item.y = result.faultClass[i].failCount;
                            classData[i] = item;
                        }
                        for(var j=0;j<result.faultDetail.datas.length;j++){
                            var jtem = {};
                            jtem.name = result.faultDetail.datas[j].faultdetail;
                            jtem.y = result.faultDetail.datas[j].failcount;
                            detailData[j] = jtem;
                        }

                        var series0={
                            name: '故障详细',
                            data:detailData,
                            cursor: 'pointer',
                            size: '130%'
                        };
                        var series1=
                        {
                            name: '故障分类',
                            data:classData,
                            cursor: 'pointer',
                            size: '105%',
                            dataLabels: {
                                color: 'white',
                                distance: -30
                            }
                        }
                        $scope.highchartpie.chartdata.series = [];
                        if(detailData.length>0)
                        {
                            $scope.highchartpie.chartdata.series = [series0,series1];
                        }
                        $scope.grid2.griddata.data = result.faultDetail.datas;
                        $scope.$apply();
                    });
                };
                var getNetWorkGroupList = function(postdata){
                    return httpservice.post("script/NetPerception/GetNetWorkGroupList",JSON.stringify(postdata),function(result){
                        $scope.gridnet.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                $scope.turnPage1= function(){
                    $scope.queryData1();
                };
                $scope.netTabsClick = function(param){
                    $scope.netgroup = param;
                    switch(param){
                        case 'mme_sgw':
                            $scope.netName = 'MME';
                            break;
                        default:
                            $scope.netName = param.toUpperCase();
                            break;
                    }

                    var colnames = [$scope.netName,'请求次数','失败次数','比例'];
                    $scope.gridnet.griddata.colnames = colnames;

                    var condition = getCondition2();

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var f = getNetWorkGroupList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                $scope.grid1 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['时间段','网元','attach请求次数','attach请求成功次数','attach成功率','pdn连接次数','pdn连接成功次数','pdn连接成功率',"tau请求次数","tau请求成功次数","tau请求成功率"],
                        colmodel: [
                            { name: 'date_time', index: 'date_time', sortable: false, align:"center"},
                            { name: 'network', index: 'network', sortable: false, align:"center"},
                            { name: 'attachcount', index: 'attachcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'attachsuccount', index: 'attachsuccount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'attachsucpct', index: 'attachsucpct', sortable: false, align:"center"},
                            { name: 'pdnconcount', index: 'pdnconcount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'pdnconsuccount', index: 'pdnconsuccount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'pdnconsucpct', index: 'pdnconsucpct', sortable: true, align:"center"},
                            { name: 'taucount', index: 'taucount', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'tausuccount', index: 'tausuccount', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'tausucpct', index: 'tausucpct', sortable: true, align:"center"}
                        ],
                        data: [
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()-23);
                        grid.setGridHeight(300);
                    }
                };
                $scope.grid2 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['故障归类','故障原因','失败次数','失败百分比','用户数'],
                        colmodel: [
                            { name: 'faultclass', index: 'faultclass', sortable: false, align:"center"},
                            { name: 'faultdetail', index: 'faultdetail', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'failpct', index: 'failpct', sortable: false, align:"center"},
                            { name: 'usercount', index: 'usercount', sortable: false, sorttype: 'number', align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    }
                };
                $scope.gridnet = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: [$scope.netName,'请求次数','失败次数','比例'],
                        colmodel: [
                            { name: 'netgroup', index: 'netgroup', sortable: false, align:"center"},
                            { name: 'requestcount', index: 'requestcount', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'failpct', index: 'failpct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(151);
                    }
                };
                $scope.highchartyy = {
                    chartdata: {
                        title: {
                            text: 'EPS附着指标趋势'
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00']
                        },
                        yAxis: [
                            { // Secondary yAxis
                                title: {
                                    text: '',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                labels: {
                                    format: '{value}次',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                min:0
                            },
                            { // Primary yAxis
                                labels: {
                                    format: '{value}%',
                                    style: {
                                        color: '#89A54E'
                                    }
                                },
                                opposite: true,
                                min: 0,
                                max:100,
                                title: {
                                    text: '',
                                    style: {
                                        color: '#89A54E'
                                    }
                                }
                            }
                        ],
                        tooltip: {
                            shared: true
                        },
                        series: [
//                            {
//                                name: '请求次数',
//                                color: '#4572A7',
//                                type: 'spline',
//                                data: [1000,3000,1000,3000,1000,3000,1000,5000,3000,8000,3000],
//                                tooltip: {
//                                    valueSuffix: '次'
//                                }
//                            },
//                            {
//                                name: '成功率',
//                                color: '#89A54E',
//                                type: 'spline',
//                                yAxis: 1,
//                                data: [80,81,20,80,81,81,81,80,81,70,10],
//                                tooltip: {
//                                    valueSuffix: '%'
//                                }
//                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartcolumn = {
                    chartdata: {
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: 'EPS附着故障原因归类分布'
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00']
                        },
                        yAxis: {
                            minorTickInterval: 'auto',
                            lineColor: '#000',
                            lineWidth: 1,
                            tickWidth: 1,
                            tickColor: '#000',
                            min: 0,
                            max:100,
                            title: {
                                text: ''
                            }
//                            labels: {
//                                rotation: -30,
//                                align: 'right',
//                                style: {
//                                    fontFamily: '黑体',
//                                    fontWeight: 'Bold'           //Times New Roman
//                                },
//                                format: '{value}%'
//                            }
                        },
                        tooltip: {
                            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
                            shared: true
                        },
                        plotOptions: {
                            column: {
                                stacking: 'percent'
                            }
                        },
                        series: [
//                            {
//                                name: '网络原因',
//                                data: [2,40,20,20,19,19,19,20,19,19,20,20,19,19,19,20,19,19,20,20,19,19,19,20]
////                            tooltip: {
////                                valueSuffix: '%'
////                            }
//                            },
//                            {
//                                name: '用户原因',
//                                data: [8,60,80,80,81,81,81,80,81,81,80,80,81,81,81,80,81,81,80,80,81,81,81,80]
////                            tooltip: {
////                                valueSuffix: '%'
////                            }
//                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartpie = {
                    chartdata: {
                        chart: {
                            type: 'pie'
                        },
                        title: {
                            text: "故障分布"
                        },
//                        plotOptions: {
//                            pie: {
//                                allowPointSelect: true,
//                                cursor: 'pointer',
//                                dataLabels: {
//                                    enabled: false
//                                },
//                                showInLegend: true
//                            }
//                        },
//                        legend: {
//                            layout: 'vertical',
//                            align: 'center',
//                            verticalAlign: 'bottom',
//                            borderWidth: 0
//                        },
//                        tooltip: {
//                            valueSuffix: '%'
//                        },
                        series: [
//                            {
//                                name: '故障详细',
//                                data: [
//                                    { name: 'Padding失败', y: 31 },
//                                    { name: 'Post失败', y: 119 },
//                                    { name: 'TCP连接失败', y: 42 },
//                                    { name: 'DNS解析失败', y: 8 }
//                                ],
//                                cursor: 'pointer',
//                                size: '130%'
//                            },
//                            {
//                                name: '故障分类',
//                                data: [
//                                    { name: '用户原因', y: 150 },
//                                    { name: '网络原因', y: 50 }
//                                ],
//                                cursor: 'pointer',
//                                size: '105%',
//                                dataLabels: {
//                                    color: 'white',
//                                    distance: -30
//                                }
//                            }
                        ]
                    },
                    obj: {}
                };
                $scope.init=function(){
                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    $scope.stime1 = dateFormat(defaultendtime, "yyyy-MM-dd");
                    $scope.etime1 = dateFormat(defaultendtime, "yyyy-MM-dd");


                    var condition = {
                        interface:$scope.interface.value,
                        starttime:$scope.stime1,
                        endtime:$scope.etime1,
                        isbusy:false,
                        timesize:$scope.size.value
                    };

                    var f = getNetWorkIndicatorsList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });

                    $scope.$emit('loading', 'false');
                    $scope.$apply();

                };
                //$scope.init();

                $scope.downloadList = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.downloadList1.gridpagedata.nowpage = 1;
                            $scope.turnPageWAPByType();
                        },
                        toToppage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage>1){
                                $scope.downloadList1.gridpagedata.nowpage--;
                            }
                            $scope.turnPageWAPByType();
                        },
                        toNextpage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage<$scope.downloadList1.gridpagedata.totalpage){
                                $scope.downloadList1.gridpagedata.nowpage++;
                            }
                            $scope.turnPageWAPByType();
                        },
                        toLastpage: function(){
                            $scope.downloadList1.gridpagedata.nowpage = $scope.downloadList1.gridpagedata.totalpage;
                            $scope.turnPageWAPByType();
                        },
                        topage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage<1){
                                $scope.downloadList1.gridpagedata.nowpage = 1;
                            }
                            if($scope.downloadList1.gridpagedata.nowpage>$scope.downloadList1.gridpagedata.totalpage){
                                $scope.downloadList1.gridpagedata.nowpage = $scope.downloadList1.gridpagedata.totalpage;
                            }
                            $scope.turnPageWAPByType();
                        },
                        changePagesize: function(){
                            $scope.downloadList1.gridpagedata.nowpage = 1;
                            $scope.turnPageWAPByType();
                        }
                    },
                    griddata: {
                        colnames: ['ID','下载文件名', '创建时间','主模块','子模块','应用名称', '下载状态', '操作'],
                        colmodel: [
                            { name: 'id', index: 'id', sortable: false, align:"center",hidden:true },
                            { name: 'filename', index: 'filename', sortable: false, align:"center" },
                            { name: 'createtime', index: 'createtime', sortable: false, align:"center" },
                            { name: 'mainmodule',width:100, index: 'mainmodule', sortable: false, align:"center"},
                            { name: 'submodule',width:100, index: 'submodule', sortable: false, align:"center"},
                            { name: 'appname',width:100, index: 'appname', sortable: false,sorttype: 'number', align:"center"},
                            { name: 'status',width:100, index: 'status', sortable: false,sorttype: 'number', align:"center"},
                            { name: 'operate', index: 'operate', sortable: false, align:"center",formatter:downloadoperate}
                        ],
                        data: [
                            { "filename": "微信", "mainmodule": 1000, "submodule":1000, "appname":1000, "createtime": 1000,"status":1000, "operate":1000}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth(800);
                        grid.setGridHeight(300);
                    }
                };

                $scope.dialogList={
                    title:"下载列表",
                    ok:function(){},
                    cancel:function(){}
                };

                $scope.showDownloadlist = function(){
                    $scope.dialogList.show();
                    var condition = {
                        mainmodule:"上网感知分析",
                        submodule:"网络质量分析",
                        appname:""
                    }
                    $scope.getDownloadList(condition);
//                    setInterval(function(){
//                        $.ajax({
//                            url:httpservice.serverurl + "script/Common/GetTaskList",
//                            type:"post",
//                            data:JSON.stringify(condition),
//                            dataType:"json",
//                            success:function(result){
//                                $scope.downloadList.griddata.data = result.datas;
//                                $scope.$apply();
//                            },
//                            error:function(xmlHttpRequest,textStatus){
//                                alert("请求出错!");
//                            },
//                            complete:function(xmlhHttpRequest,textStatus){
//
//                            }
//                        });
//                    },500);
                }

                $scope.getDownloadList = function(postdata){
                    $.ajax({
                        url:httpservice.serverurl + "script/Common/GetTaskList",
                        type:"post",
                        data:JSON.stringify(postdata),
                        dataType:"json",
                        success:function(result){
                            $scope.downloadList.griddata.data = result.datas;
                            $scope.$apply();
                        },
                        error:function(xmlHttpRequest,textStatus){
                            alert("请求出错!");
                        },
                        complete:function(xmlhHttpRequest,textStatus){

                        }
                    });
                }

            };

            var businessCtrl = function ($scope, httpservice){
                //删除下载文件
                $(".deletemodel").live("click",function(e){
                    var fileId = $(e.target).parent().attr("id");
                    if(confirm('你确定要删除该文件?')){
                        $.ajax({
                            url:httpservice.serverurl + "script/Common/DeleteTask",
                            type:"get",
                            data:{id:fileId},
                            dataType:"json",
                            success:function(result){
                                if(result.state){
                                    var condition = {
                                        mainmodule:"上网感知分析",
                                        submodule:"业务质量分析"
                                    }
                                    $scope.getDownloadList(condition);
                                    alert('删除成功!');
                                }
                                else{
                                    alert('删除失败!');
                                }
                            },
                            error:function(xmlHttpRequest,textStatus){
                                alert('请求出错!');
                            },
                            complete:function(xmlHttpRequest,textStatus){

                            }
                        });
                    }
                })

                var downloadoperate = function(cellvalue, options, rowObject){
                    var listprint = "<a class='viewmodel' href='javascript:'id='"+rowObject.id+"' title = '查看'><img src='../../../images/chakan.png' /></a>" +
                        "<a class='downloadmodel' style='margin: 0 15px;' href= '"+httpservice.downloadurl+""+rowObject.filename+".csv' target='_blank' id='"+rowObject.id+"' state='"+rowObject.status+"' title='下载'><img src='../../../images/download.png' /></a>" +
                        "<a class='deletemodel' href='javascript:' id='"+rowObject.id+"' state='"+rowObject.state+"' title='删除'><img src='../../../images/delete1.png' /></a>";
                    return listprint;
                };
                $scope.selectSizes1 = [
                    {value:"fivemin",name:"5分钟"},
                    {value:"fifteenmin",name:"15分钟"},
                    {value:"hour",name:"1小时"}
                ];
                $scope.selectSizes2 = [
                    {value:"fifteenmin",name:"15分钟"},
                    {value:"hour",name:"小时"},
                    {value:"day",name:"天"}
                ];
                $scope.selectSizes3 = [
                    {value:"fifteenmin",name:"15分钟"},
                    {value:"hour",name:"小时"},
                    {value:"day",name:"天"}
                ];
                $scope.timesize1 = $scope.selectSizes1[0];
                $scope.timesize2 = $scope.selectSizes2[0];
                $scope.timesize3 = $scope.selectSizes3[0];
                $scope.changeTimeSize1 = function(e){
                    $scope.timesize1 = e.timesize1;
                };
                $scope.changeTimeSize2 = function(time){
                    var pram = time.timesize2;
                    $scope.timesize2 = pram;
                    if (pram.value == "day") {
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                    }
                    else {
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                    }
                };
                $scope.changeTimeSize3 = function(time){
                    var pram = time.timesize3;
                    $scope.timesize3 = pram;
                    if (pram.value == "day") {
                        $("#starttime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                        $("#endtime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                    }
                    else {
                        $("#starttime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                        $("#endtime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                    }
                };
                $scope.netgroup = 'mme_sgw';
                $scope.netName = 'MME';
                $scope.netgroup1 = 'mme_sgw';
                $scope.netName1 = 'SGW';
                $scope.startTime = '';
                $scope.endTime = '';
                $scope.servicetype = '';
                var getCondition1 = function(){
                    return {
                        ispage:true,
                        pageindex:$scope.grid1.gridpagedata.nowpage,
                        pagesize:$scope.grid1.gridpagedata.pagesize,
                        interface:$('#interface1 option:selected').val(),
                        starttime:$('#starttime1').val(),
                        endtime:$('#endtime1').val(),
                        isbusy:$('#isbusy').is(':checked'),
                        timesize:$scope.timesize1.value
                    };
                };
                var getCondition2 = function(){
                    return {
                        interface:$('#interface2 option:selected').val(),
                        starttime:$('#starttime2').val(),
                        endtime:$('#endtime2').val(),
                        timesize:$scope.timesize2.value,
                        eventtype:$('#selectEventType option:selected').val(),
                        netgroup:$scope.netgroup
                    };
                };
                var getCondition3 = function(){
                    return {
                        interface:$('#interface3 option:selected').val(),
                        starttime:$('#starttime3').val(),
                        endtime:$('#endtime3').val(),
                        timesize:$scope.timesize3.value,
                        netgroup:$scope.netgroup1
                    };
                };
                var getCondition4 = function(){
                    return {
                        interface:$('#interface3 option:selected').val(),
                        starttime:$scope.startTime,
                        endtime:$scope.endTime,
                        timesize:$scope.timesize3.value,
                        netgroup:$scope.netgroup1,
                        servicetype:$scope.servicetype
                    };
                };
                $scope.btnSearch1 = function (){
                    if($('#starttime1').val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($('#endtime1').val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime1").val())<new Date($("#starttime1").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }

                    $scope.queryData1();
                };
                $scope.btnSearch2 = function (){
                    if($('#starttime2').val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($('#endtime2').val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime2").val())<new Date($("#starttime2").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }

                    var startTime = new Date($("#starttime2").val());
                    var endTime = new Date($("#endtime2").val());

                    var size = $scope.timesize2.value;
                    switch(size){
                        case 'day':
                            if(getTimeDiffValue(endTime,startTime,'day')>7){
                                alert('时间范围不能超过7天!');
                                return false;
                            }
                            break;
                        case 'hour':
                            if(getTimeDiffValue(endTime,startTime,'hour')>24){
                                alert('时间范围不能超过24个小时!');
                                return false;
                            }
                            break;
                        case 'fifteenmin':
                            if(getTimeDiffValue(endTime,startTime,'hour')>5){
                                alert('时间范围不能超过5个小时!');
                                return false;
                            }
                            break;
                        default:
                            break;
                    }

                    $scope.queryData2();
                };
                $scope.btnSearch3 = function (){
                    if($('#starttime3').val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($('#endtime3').val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime3").val())<new Date($("#starttime3").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }

                    $scope.startTime = $('#starttime3').val();
                    $scope.endTime = $('#endtime3').val();
                    var startTime = new Date($("#starttime3").val());
                    var endTime = new Date($("#endtime3").val());

                    var size = $scope.timesize3.value;
                    switch(size){
                        case 'day':
                            $scope.endTime = $('#starttime3').val();
                            if(getTimeDiffValue(endTime,startTime,'day')>7){
                                alert('时间范围不能超过7天!');
                                return false;
                            }
                            break;
                        case 'hour':
                            $scope.endTime = dateFormat(addMinutes(startTime,60),'yyyy-MM-dd hh:mm');
                            if(getTimeDiffValue(endTime,startTime,'hour')>24){
                                alert('时间范围不能超过24个小时!');
                                return false;
                            }
                            break;
                        case 'fifteenmin':
                            $scope.endTime = dateFormat(addMinutes(startTime,15),'yyyy-MM-dd hh:mm');
                            if(getTimeDiffValue(endTime,startTime,'hour')>5){
                                alert('时间范围不能超过5个小时!');
                                return false;
                            }
                            break;
                        default:
                            break;
                    }

                    $scope.queryData3();
                };
                $scope.queryData1 = function(){

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var condition = getCondition1();

                    var f = getBusinessIndicatorsList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                $scope.queryData2 = function(){

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var condition = getCondition2();

                    var f1 = getBusinessFaultTrend(condition);
                    var f2 = getBusinessFaultReasonClass(condition);
                    var f3 = getBusinessGroupList(condition);
                    var f4 = getBusinessFaultReasonDetailList(condition);

                    $.when(f1,f2,f3,f4).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                $scope.queryData3 = function(){

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var condition = getCondition4();

                    var f1 = getBusinessRateTrend(getCondition3());
                    var f2 = getBusinessRateServiceTypeList(condition);
                    //var f3 = getBusinessRateSubServiceTypeList(condition);
                    //var f4 = getBusinessRateGroupList(condition);

                    $.when(f1,f2).then(function () {
                        if($scope.gridServiceType.griddata.data.length){
                            $scope.servicetype = $scope.gridServiceType.griddata.data[0]["servicetypecode"];
                            condition.servicetype = $scope.servicetype;
                            getBusinessRateSubServiceTypeList(condition);
                            getBusinessRateGroupList(condition);

                        }
                        else{
                            $scope.gridServiceType.griddata.data = [];
                            $scope.gridBusinessRateGroup.griddata.data = [];
                        }
                    }).always(function() {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                //导出业务指标所有数据
                $scope.exportBusinessIndicatorData = function(){
                    var condition = getCondition1();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "业务质量分析";
                    condition.appname = "指标分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitBusinessIndicatorsDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                //导出业务故障原因详细所有数据
                $scope.exportBusinessFaultReasonDetailData = function(){
                    var condition = getCondition2();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "业务质量分析";
                    condition.appname = "故障分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitBusinessFaultReasonDetailDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                //导出网元分组数据
                $scope.exportBusinessGroupData = function(){
                    var condition = getCondition2();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "业务质量分析";
                    condition.appname = "故障分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitBusinessGroupDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                //导出速率分析业务类型数据
                $scope.exportBusinessRateServiceTypeData = function(){
                    var condition = getCondition4();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "业务质量分析";
                    condition.appname = "速率分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitBusinessRateServiceTypeDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                //导出速率分析子业务数据
                $scope.exportBusinessRateSubServiceTypeData = function(){
                    var condition = getCondition4();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "业务质量分析";
                    condition.appname = "速率分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitBusinessRateSubServiceTypeDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                //导出速率分析网元分组数据
                $scope.exportBusinessRateGroupData = function(){
                    var condition = getCondition4();
                    condition.mainmodule = "上网感知分析";
                    condition.submodule = "业务质量分析";
                    condition.appname = "速率分析";
                    var requestUrl = httpservice.serverurl + "script/NetPerception/SubmitBusinessRateGroupDownloadTask";

                    submitDownloadTask(condition,requestUrl);
                };

                var getBusinessIndicatorsList = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessIndicatorsList",JSON.stringify(postdata),function(result){
                        $scope.grid1.gridpagedata.totalcount = result.recordCount;
                        $scope.grid1.gridpagedata.totalpage = result.pageCount;
                        $scope.grid1.gridpagedata.startline = result.startLine;
                        $scope.grid1.gridpagedata.endline = result.endLine;
                        $scope.grid1.gridpagedata.datacount = result.dataCount;
                        $scope.grid1.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                var getBusinessFaultTrend = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessFaultTrend",JSON.stringify(postdata),function(result){
                        var title = $('#selectEventType option:selected').text()+"指标趋势";
                        var data1 = result[0].y1Series.values,
                            data2 = result[1].y1Series.values;
                        var series0=
                        {
                            name: '请求次数',
                            color: '#4572A7',
                            type: 'spline',
                            data: data1,
                            tooltip: {
                                valueSuffix: '次'
                            }
                        };
                        var series1=
                        {
                            name: '成功率',
                            color: '#89A54E',
                            type: 'spline',
                            yAxis: 1,
                            data: data2,
                            tooltip: {
                                valueSuffix: '%'
                            }
                        };
                        $scope.highchartyy.chartdata.series = [];
                        if(data1.length>0||data2.length>0){
                            $scope.highchartyy.chartdata.series = [series0,series1];
                        }

                        $scope.highchartyy.chartdata.title.text = title;
                        $scope.highchartyy.chartdata.xAxis.categories = result[0].xSeries;

                        $scope.$apply();
                    });
                };
                var getBusinessFaultReasonClass = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessFaultReasonClass",JSON.stringify(postdata),function(result){
                        var title = $('#selectEventType option:selected').text()+"故障原因归类分布";
                        var netData = result[0].y1Series.values,
                            userData = result[1].y1Series.values,
                            spData = result[2].y1Series.values;
                        var series0=
                        {
                            name: '网络原因',
                            data: netData

                        };
                        var series1=
                        {
                            name: '用户原因',
                            data: userData

                        };
                        var series2=
                        {
                            name: '服务商原因',
                            data: spData

                        };
                        $scope.highchartcolumn.chartdata.series = [];
                        if(netData.length>0||userData.length>0||spData.length>0){
                            $scope.highchartcolumn.chartdata.series = [series0,series1,series2];
                        }

                        $scope.highchartcolumn.chartdata.title.text = title;
                        $scope.highchartcolumn.chartdata.xAxis.categories=result[0].xSeries;

                        $scope.$apply();
                    });
                };
                var getBusinessFaultReasonDetailList = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessFaultReasonDetailList",JSON.stringify(postdata),function(result){
                        var classData = [],detailData = [];
                        for(var i=0;i<result.faultClass.length;i++){
                            var item = {};
                            item.name = result.faultClass[i].class;
                            item.y = result.faultClass[i].failCount;
                            classData[i] = item;
                        }
                        for(var j=0;j<result.faultDetail.datas.length;j++){
                            var jtem = {};
                            jtem.name = result.faultDetail.datas[j].faultdetail;
                            jtem.y = result.faultDetail.datas[j].failcount;
                            detailData[j] = jtem;
                        }

                        var series0={
                            name: '故障详细',
                            data:detailData,
                            cursor: 'pointer',
                            size: '130%'
                        };
                        var series1=
                        {
                            name: '故障分类',
                            data:classData,
                            cursor: 'pointer',
                            size: '105%',
                            dataLabels: {
                                color: 'white',
                                distance: -30
                            }
                        }
                        $scope.highchartpie.chartdata.series = [];
                        if(detailData.length>0)
                        {
                            $scope.highchartpie.chartdata.series = [series0,series1];
                        }
                        $scope.grid2.griddata.data = result.faultDetail.datas;
                        $scope.$apply();
                    });
                };
                var getBusinessGroupList = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessGroupList",JSON.stringify(postdata),function(result){
                        $scope.gridnet.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                var getBusinessRateTrend = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessRateTrend",JSON.stringify(postdata),function(result){
                        var data1 = result[0].y1Series.values,
                            data2 = result[1].y1Series.values;
                        var series0=
                        {
                            name: '流量',
                            color: '#4572A7',
                            type: 'spline',
                            data: data1,
                            tooltip: {
                                valueSuffix: '(MB)'
                            }
                        };
                        var series1=
                        {
                            name: '平均速率',
                            color: '#89A54E',
                            type: 'spline',
                            yAxis: 1,
                            data: data2,
                            tooltip: {
                                valueSuffix: 'kbps'
                            }
                        };
                        $scope.highchartyy3.chartdata.series = [];
                        if(data1.length>0||data2.length>0){
                            $scope.highchartyy3.chartdata.series = [series0,series1];
                        }
                        $scope.highchartyy3.chartdata.xAxis.categories = result[0].xSeries;
                        $scope.highchartyy3.chartdata.xAxis.time = result[0].xSeries;

                        $scope.$apply();
                    });
                };
                var getBusinessRateServiceTypeList = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessRateServiceTypeList",JSON.stringify(postdata),function(result){
                        $scope.gridServiceType.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                var getBusinessRateSubServiceTypeList = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessRateSubServiceTypeList",JSON.stringify(postdata),function(result){
                        $scope.gridSubServiceType.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                var getBusinessRateGroupList = function(postdata){
                    return httpservice.post("script/NetPerception/GetBusinessRateGroupList",JSON.stringify(postdata),function(result){
                        $scope.gridBusinessRateGroup.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                $scope.turnPage1= function(){
                    $scope.queryData1();
                };
                $scope.netTabsClick = function(param){
                    $scope.netgroup = param;
                    switch(param){
                        case 'mme_sgw':
                            $scope.netName = 'MME';
                            break;
                        default:
                            $scope.netName = param.toUpperCase();
                            break;
                    }

                    var colnames = [$scope.netName,'请求次数','失败次数','比例'];
                    $scope.gridnet.griddata.colnames = colnames;

                    var condition = getCondition2();

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var f = getBusinessGroupList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                $scope.netTabsClick1 = function(param){
                    $scope.netgroup1 = param;
                    switch(param){
                        case 'mme_sgw':
                            $scope.netName1 = 'SGW';
                            break;
                        default:
                            $scope.netName1 = param.toUpperCase();
                            break;
                    }
                    var condition = getCondition4();

                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    var f = getBusinessRateGroupList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                $scope.grid1 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['时间段','网元','TCP连接次数','TCP连接成功次数','TCP连接成功率','DNS查询次数','DNS查询成功次数','DNS查询成功率',"HTTP请求次数 ","HTTP请求成功次数","HTTP请求成功率"],
                        colmodel: [
                            { name: 'date_time', index: 'date_time', sortable: false, align:"center"},
                            { name: 'network', index: 'network', sortable: false, align:"center"},
                            { name: 'TCPcount', index: 'TCPcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'TCPsuccount', index: 'TCPsuccount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'TCPsucpct', index: 'TCPsucpct', sortable: false, align:"center"},
                            { name: 'DNScount', index: 'DNScount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'DNSsuccount', index: 'DNSsuccount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'DNSsucpct', index: 'DNSsucpct', sortable: true, align:"center"},
                            { name: 'HTTPcount', index: 'HTTPcount', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'HTTPsuccount', index: 'HTTPsuccount', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'HTTPsucpct', index: 'HTTPsucpct', sortable: true, align:"center"}
                        ],
                        data: [
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()-23);
                        grid.setGridHeight(300);
                    }
                };
                $scope.grid2 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['故障归类','故障原因','失败次数','失败百分比','用户数'],
                        colmodel: [
                            { name: 'faultclass', index: 'faultclass', sortable: false, align:"center"},
                            { name: 'faultdetail', index: 'faultdetail', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'failpct', index: 'failpct', sortable: false, align:"center"},
                            { name: 'usercount', index: 'usercount', sortable: false, sorttype: 'number', align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    }
                };
                $scope.gridServiceType = {
                    griddata: {
                        colnames: ['业务编码','业务类型','流量(MB)','速率(kbps)','请求次数','上行重传率','下行重传率'],
                        colmodel: [
                            { name: 'servicetypecode', index: 'servicetypecode', sortable: false, align:"center",hidden:true},
                            { name: 'servicetype', index: 'servicetype', sortable: false, align:"center"},
                            { name: 'totallen', index: 'totallen', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'rate', index: 'rate', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'requestcount', index: 'requestcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'ulpct', index: 'ulpct', sortable: false, align:"center"},
                            { name: 'dlpct', index: 'dlpct', sortable: false, align:"center"}
                        ],
                        data: [


//                            { "servicetype": "视频", "totallen": "2222", "rate": "1000", "requestcount": "10000"},

//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    },
                    onSelectRow: function (index) {
                        $scope.servicetype = $scope.gridServiceType.griddata.data[index - 1]["servicetypecode"];
                        var condition = getCondition4();

                        $scope.$emit('loading', 'true');
                        $scope.$apply();

                        var f1 = getBusinessRateSubServiceTypeList(condition);
                        var f2 = getBusinessRateGroupList(condition);

                        $.when(f1,f2).done(function () {

                        }).always(function () {
                                $scope.$emit('loading', 'false');
                                $scope.$apply();
                            })

                    }
                };
                $scope.gridSubServiceType = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['业务名称','流量(MB)','速率(kbps)','请求次数','上行重传率','下行重传率'],
                        colmodel: [
                            { name: 'subservicetype', index: 'subservicetype', sortable: false, align:"center"},
                            { name: 'totallen', index: 'totallen', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'rate', index: 'rate', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'requestcount', index: 'requestcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'ulpct', index: 'ulpct', sortable: false, align:"center"},
                            { name: 'dlpct', index: 'dlpct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    }
                };
                $scope.gridnet = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: [$scope.netName,'请求次数','失败次数','比例'],
                        colmodel: [
                            { name: 'netgroup', index: 'netgroup', sortable: false, align:"center"},
                            { name: 'requestcount', index: 'requestcount', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'failpct', index: 'failpct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(151);
                    }
                };
                $scope.gridBusinessRateGroup = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['网元分布','流量(MB)','速率(kbps)','请求次数','上行重传率','下行重传率'],
                        colmodel: [
                            { name: 'netgroup', index: 'netgroup', sortable: false, align:"center"},
                            { name: 'totallen', index: 'totallen', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'rate', index: 'rate', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'requestcount', index: 'requestcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'ulpct', index: 'ulpct', sortable: false, align:"center"},
                            { name: 'dlpct', index: 'dlpct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(151);
                    }
                };
                $scope.highchartyy = {
                    chartdata: {
                        title: {
                            text: 'TCP连接指标趋势'
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00']
                        },
                        yAxis: [
                            { // Secondary yAxis
                                title: {
                                    text: '',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                labels: {
                                    format: '{value}次',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                min:0
                            },
                            { // Primary yAxis
                                labels: {
                                    format: '{value}%',
                                    style: {
                                        color: '#89A54E'
                                    }
                                },
                                opposite: true,
                                min: 0,
                                max:100,
                                title: {
                                    text: '',
                                    style: {
                                        color: '#89A54E'
                                    }
                                }
                            }
                        ],
                        tooltip: {
                            shared: true
                        },
                        series: [
//                            {
//                                name: '请求次数',
//                                color: '#4572A7',
//                                type: 'spline',
//                                data: [1000,3000,1000,3000,1000,3000,1000,5000,3000,8000,3000],
//                                tooltip: {
//                                    valueSuffix: '次'
//                                }
//                            },
//                            {
//                                name: '成功率',
//                                color: '#89A54E',
//                                type: 'spline',
//                                yAxis: 1,
//                                data: [80,81,20,80,81,81,81,80,81,70,10],
//                                tooltip: {
//                                    valueSuffix: '%'
//                                }
//                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartyy3 = {
                    chartdata: {
                        title: {
                            text: '全网业务指标趋势'
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        plotOptions: {
                            series: {
                                point: {
                                    events: {
                                        click: function () {
                                            $scope.$emit('loading', 'true');
                                            $scope.$apply();

                                            $scope.startTime = this.category;
                                            var size = $scope.timesize3.value;
                                            switch(size){
                                                case 'day':
                                                    $scope.endTime = $scope.startTime;
                                                    break;
                                                case 'hour':
                                                    $scope.endTime = dateFormat(addMinutes(new Date($scope.startTime),60),'yyyy-MM-dd hh:mm');
                                                    break;
                                                case 'fifteenmin':
                                                    $scope.endTime = dateFormat(addMinutes(new Date($scope.startTime),15),'yyyy-MM-dd hh:mm');
                                                    break;
                                                default:
                                                    break;
                                            }
                                            var condition = getCondition4();
                                            var f = getBusinessRateServiceTypeList(condition);

                                            $.when(f).then(function () {
                                                if($scope.gridServiceType.griddata.data.length){
                                                    var type = $scope.gridServiceType.griddata.data[0]["servicetypecode"];
                                                    condition.servicetype = type;
                                                    getBusinessRateSubServiceTypeList(condition);
                                                    getBusinessRateGroupList(condition);
                                                }
                                                else{
                                                    $scope.gridServiceType.griddata.data = [];
                                                    $scope.gridBusinessRateGroup.griddata.data = [];
                                                }
                                            }).always(function () {
                                                    $scope.$emit('loading', 'false');
                                                    $scope.$apply();
                                                });
                                        }
                                    }
                                }
                            }
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00']
                        },
                        yAxis: [
                            { // Secondary yAxis
                                title: {
                                    text: '',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                labels: {
                                    format: '{value}(MB)',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                min:0
                            },
                            { // Primary yAxis
                                labels: {
                                    format: '{value}(Kbps)',
                                    style: {
                                        color: '#89A54E'
                                    }
                                },
                                min:0,
                                opposite: true,
                                title: {
                                    text: '',
                                    style: {
                                        color: '#89A54E'
                                    }
                                }
                            }
                        ],
                        tooltip: {
                            shared: true
                        },
                        series: [
//                            {
//                                name: '请求次数',
//                                color: '#4572A7',
//                                type: 'spline',
//                                data: [1000,3000,1000,3000,1000,3000,1000,5000,3000,8000,3000],
//                                tooltip: {
//                                    valueSuffix: '(MB)'
//                                }
//                            },
//                            {
//                                name: '成功率',
//                                color: '#89A54E',
//                                type: 'spline',
//                                yAxis: 1,
//                                data: [80,81,20,80,81,81,81,80,81,70,10],
//                                tooltip: {
//                                    valueSuffix: '(kbps)'
//                                }
//                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartcolumn = {
                    chartdata: {
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: 'TCP连接故障原因归类分布'
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00']
                        },
                        yAxis: {
                            minorTickInterval: 'auto',
                            lineColor: '#000',
                            lineWidth: 1,
                            tickWidth: 1,
                            tickColor: '#000',
                            min: 0,
                            max:100,
                            title: {
                                text: ''
                            }
//                            labels: {
//                                rotation: -30,
//                                align: 'right',
//                                style: {
//                                    fontFamily: '黑体',
//                                    fontWeight: 'Bold'           //Times New Roman
//                                },
//                                format: '{value}%'
//                            }
                        },
                        tooltip: {
                            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
                            shared: true
                        },
                        plotOptions: {
                            column: {
                                stacking: 'percent'
                            }
                        },
                        series: [
//                            {
//                                name: '网络原因',
//                                data: [2,40,20,20,19,19,19,20,19,19,20,20,19,19,19,20,19,19,20,20,19,19,19,20]
////                            tooltip: {
////                                valueSuffix: '%'
////                            }
//                            },
//                            {
//                                name: '用户原因',
//                                data: [8,60,80,80,81,81,81,80,81,81,80,80,81,81,81,80,81,81,80,80,81,81,81,80]
////                            tooltip: {
////                                valueSuffix: '%'
////                            }
//                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartpie = {
                    chartdata: {
                        chart: {
                            type: 'pie'
                        },
                        title: {
                            text: "故障分布"
                        },
                        plotOptions: {
                            pie: {
                                allowPointSelect: true,
                                cursor: 'pointer',
                                dataLabels: {
                                    enabled: false
                                },
                                showInLegend: true
                            }
                        },
                        legend: {
                            layout: 'vertical',
                            align: 'right',
                            verticalAlign: 'middle',
                            borderWidth: 0
                        },
//                        tooltip: {
//                            valueSuffix: '%'
//                        },
                        series: [
//                            {
//                                name: '故障详细',
//                                data: [
//                                    { name: 'Padding失败', y: 31 },
//                                    { name: 'Post失败', y: 119 },
//                                    { name: 'TCP连接失败', y: 42 },
//                                    { name: 'DNS解析失败', y: 8 }
//                                ],
//                                cursor: 'pointer',
//                                size: '130%'
//                            },
//                            {
//                                name: '故障分类',
//                                data: [
//                                    { name: '用户原因', y: 150 },
//                                    { name: '网络原因', y: 50 }
//                                ],
//                                cursor: 'pointer',
//                                size: '105%',
//                                dataLabels: {
//                                    color: 'white',
//                                    distance: -30
//                                }
//                            }
                        ]
                    },
                    obj: {}
                };
                $scope.init=function(){
                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    $scope.stime1 = dateFormat(defaultendtime, "yyyy-MM-dd");
                    $scope.etime1 = dateFormat(defaultendtime, "yyyy-MM-dd");


                    var condition = {
                        interface:$scope.interface.value,
                        starttime:$scope.stime1,
                        endtime:$scope.etime1,
                        isbusy:false,
                        timesize:$scope.size.value
                    };

                    var f = getNetWorkIndicatorsList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });

                    $scope.$emit('loading', 'false');
                    $scope.$apply();

                };
                //$scope.init();
                $scope.downloadList = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.downloadList1.gridpagedata.nowpage = 1;
                            $scope.turnPageWAPByType();
                        },
                        toToppage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage>1){
                                $scope.downloadList1.gridpagedata.nowpage--;
                            }
                            $scope.turnPageWAPByType();
                        },
                        toNextpage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage<$scope.downloadList1.gridpagedata.totalpage){
                                $scope.downloadList1.gridpagedata.nowpage++;
                            }
                            $scope.turnPageWAPByType();
                        },
                        toLastpage: function(){
                            $scope.downloadList1.gridpagedata.nowpage = $scope.downloadList1.gridpagedata.totalpage;
                            $scope.turnPageWAPByType();
                        },
                        topage: function(){
                            if($scope.downloadList1.gridpagedata.nowpage<1){
                                $scope.downloadList1.gridpagedata.nowpage = 1;
                            }
                            if($scope.downloadList1.gridpagedata.nowpage>$scope.downloadList1.gridpagedata.totalpage){
                                $scope.downloadList1.gridpagedata.nowpage = $scope.downloadList1.gridpagedata.totalpage;
                            }
                            $scope.turnPageWAPByType();
                        },
                        changePagesize: function(){
                            $scope.downloadList1.gridpagedata.nowpage = 1;
                            $scope.turnPageWAPByType();
                        }
                    },
                    griddata: {
                        colnames: ['ID','下载文件名', '创建时间','主模块','子模块','应用名称', '下载状态', '操作'],
                        colmodel: [
                            { name: 'id', index: 'id', sortable: false, align:"center",hidden:true },
                            { name: 'filename', index: 'filename', sortable: false, align:"center" },
                            { name: 'createtime', index: 'createtime', sortable: false, align:"center" },
                            { name: 'mainmodule',width:100, index: 'mainmodule', sortable: false, align:"center"},
                            { name: 'submodule',width:100, index: 'submodule', sortable: false, align:"center"},
                            { name: 'appname',width:100, index: 'appname', sortable: false,sorttype: 'number', align:"center"},
                            { name: 'status',width:100, index: 'status', sortable: false,sorttype: 'number', align:"center"},
                            { name: 'operate', index: 'operate', sortable: false, align:"center",formatter:downloadoperate}
                        ],
                        data: [
                            { "filename": "微信", "mainmodule": 1000, "submodule":1000, "appname":1000, "createtime": 1000,"status":1000, "operate":1000}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth(800);
                        grid.setGridHeight(300);
                    }
                };

                $scope.dialogList={
                    title:"下载列表",
                    ok:function(){},
                    cancel:function(){}
                };

                $scope.showDownloadlist = function(){
                    $scope.dialogList.show();
                    var condition = {
                        mainmodule:"上网感知分析",
                        submodule:"业务质量分析",
                        appname:""
                    }
                    $scope.getDownloadList(condition);
//                    setInterval(function(){
//                        $.ajax({
//                            url:httpservice.serverurl + "script/Common/GetTaskList",
//                            type:"post",
//                            data:JSON.stringify(condition),
//                            dataType:"json",
//                            success:function(result){
//                                $scope.downloadList.griddata.data = result.datas;
//                                $scope.$apply();
//                            },
//                            error:function(xmlHttpRequest,textStatus){
//                                alert("请求出错!");
//                            },
//                            complete:function(xmlhHttpRequest,textStatus){
//
//                            }
//                        });
//                    },500);
                }

                $scope.getDownloadList = function(postdata){
                    $.ajax({
                        url:httpservice.serverurl + "script/Common/GetTaskList",
                        type:"post",
                        data:JSON.stringify(postdata),
                        dataType:"json",
                        success:function(result){
                            $scope.downloadList.griddata.data = result.datas;
                            $scope.$apply();
                        },
                        error:function(xmlHttpRequest,textStatus){
                            alert("请求出错!");
                        },
                        complete:function(xmlhHttpRequest,textStatus){

                        }
                    });
                }
            };

            var scenarioCtrl = function ($scope, httpservice){
                //标明用户组类型
                var groupType1 = '用户组';
                var groupType2 = '用户组';
                var groupType3 = '用户组';
                var groupType4 = '用户组';
                var groupType5 = '用户组';
                var netqulitycondition;
                var netqulitydown=false;
                var starttime3;
                var endtime3;
                $scope.failurratio;
                $scope.failurratiodown=false;
                $scope.netdetailcondition;
                $scope.netdetailconditiondown=false;
                $scope.selectInterfaces = [
                    {value:"S1",name:"S1"}
                ];
                $scope.selectSizes = [
                    {value:"5",name:"5分钟"},
                    {value:"15",name:"15分钟"},
                    {value:"60",name:"1小时"}
                ];
                $scope.selecttimeSizes = [
                    {value:"minutes",name:"15分钟"},
                    {value:"hour",name:"小时"},
                    {value:"day",name:"天"}
                ];

                //业务质量分析和业务故障分析的时间粒度
                $scope.selecttimeSizes_ywzl = [
                    {value:"60",name:"1小时"},
                    {value:"5",name:"5分钟"},
                    {value:"15",name:"15分钟"}

                ];
                $scope.selecttimeSizes_ywgz = [
                    {value:"1440",name:"天"},
                    {value:"15",name:"15分钟"},
                    {value:"60",name:"小时"}

                ];

                //网络故障分析时间粒度
                $scope.selecttimeSizes_wlgz = [
                    {value:"fifteenmin",name:"15分钟"},
                    {value:"hour",name:"小时"},
                    {value:"day",name:"天"}
                ]

                //速率分析的时间粒度
                $scope.selecttimeSizes_sl = [
                    {value:"1440",name:"天"},
                    {value:"15",name:"15分钟"},
                    {value:"60",name:"小时"}

                ];



                $scope.interface = $scope.selectInterfaces[0];
                $scope.size = $scope.selectSizes[0];
                $scope.timesize = $scope.selecttimeSizes_wlgz[0];
                $scope.timesize_ywzl = $scope.selecttimeSizes_ywzl[0];
                $scope.timesize_ywgz = $scope.selecttimeSizes_ywgz[0];
                $scope.timesize_sl = $scope.selecttimeSizes_sl[0];
                $scope.selectInterface=function(e){
                    $scope.interface = e.interface;
                };
                $scope.selectSize=function(e){
                    $scope.size = e.size;
                };
                $scope.selecttimeSize=function(e){
                    $scope.timesize = e.timesize;
                };
                $scope.selecttimeSize = function(time){
                    var pram = time.timesize;
                    $scope.timesize = pram;
                    if (pram.value =="day") {
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                    }
                    else {
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                    }
                };
                //网络故障分析
                $scope.selecttimeSize_wlgz = function(time){
                    var pram = time.timesize;
                    $scope.timesize = pram;
                    if (pram.value == "day") {
                        $("#starttime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd '})");
                        $("#endtime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd '})");
                    }
                    else {
                        $("#starttime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                        $("#endtime3").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00'})");
                    }
                };
                
                //业务质量分析和业务故障分析的时间粒度
                $scope.selecttimeSize_ywzl = function(time){
                    var pram = time.timesize_ywzl;
                    $scope.timesize_ywzl = pram;
                    if (pram.value == "60") {
                        if($("#starttime2").val() != ''){
                            $("#starttime2").val(dateFormat(new Date(Date.parse($("#starttime2").val())),"yyyy-MM-dd"));
                        }
                        if($("#endtime2").val() != ''){
                            $("#endtime2").val(dateFormat(new Date(Date.parse($("#endtime2").val())),"yyyy-MM-dd"));
                        }
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                    }
                    else if(pram.value == "15"){
                        if($("#starttime2").val() != ''){
                            $("#starttime2").val(dateFormat(new Date(Date.parse($("#starttime2").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        if($("#endtime2").val() != ''){
                            $("#endtime2").val(dateFormat(new Date(Date.parse($("#endtime2").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                    }else if(pram.value == "5"){
                        if($("#starttime2").val() != ''){
                            $("#starttime2").val(dateFormat(new Date(Date.parse($("#starttime2").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        if($("#endtime2").val() != ''){
                            $("#endtime2").val(dateFormat(new Date(Date.parse($("#endtime2").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        $("#starttime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                        $("#endtime2").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                    }
                };

                $scope.selecttimeSize_ywgz = function(time){
                    var pram = time.timesize_ywgz;
                    $scope.timesize_ywgz = pram;
                    if (pram.value == "1440") {
                        if($("#starttime4").val() != ''){
                            $("#starttime4").val(dateFormat(new Date(Date.parse($("#starttime4").val())),"yyyy-MM-dd "));
                        }
                        if($("#endtime4").val() != ''){
                            $("#endtime4").val(dateFormat(new Date(Date.parse($("#endtime4").val())),"yyyy-MM-dd "));
                        }
                        $("#starttime4").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                        $("#endtime4").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                    }
                    else if(pram.value == "60"){
                        if($("#starttime4").val() != ''){
                            $("#starttime4").val(dateFormat(new Date(Date.parse($("#starttime4").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        if($("#endtime4").val() != ''){
                            $("#endtime4").val(dateFormat(new Date(Date.parse($("#endtime4").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        $("#starttime4").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                        $("#endtime4").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                    }else if(pram.value == "15"){
                        if($("#starttime4").val() != ''){
                            $("#starttime4").val(dateFormat(new Date(Date.parse($("#starttime4").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        if($("#endtime4").val() != ''){
                            $("#endtime4").val(dateFormat(new Date(Date.parse($("#endtime4").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        $("#starttime4").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                        $("#endtime4").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                    }
                };

                //网络质量和网络故障分析

                //速率分析的时间粒度
                $scope.selecttimeSize_sl = function(time){
                    var pram = time.timesize_sl;
                    $scope.timesize_sl = pram;
                    if (pram.value == "1440") {
                        if($("#starttime5").val() != ''){
                            $("#starttime5").val(dateFormat(new Date(Date.parse($("#starttime5").val())),"yyyy-MM-dd"));
                        }
                        if($("#endtime5").val() != ''){
                            $("#endtime5").val(dateFormat(new Date(Date.parse($("#endtime5").val())),"yyyy-MM-dd"));
                        }
                        $("#starttime5").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                        $("#endtime5").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'})");
                    }
                    else if(pram.value == "60"){
                        if($("#starttime5").val() != ''){
                            $("#starttime5").val(dateFormat(new Date(Date.parse($("#starttime5").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        if($("#endtime5").val() != ''){
                            $("#endtime5").val(dateFormat(new Date(Date.parse($("#endtime5").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        $("#starttime5").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                        $("#endtime5").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                    }else if(pram.value == "15"){
                        if($("#starttime5").val() != ''){
                            $("#starttime5").val(dateFormat(new Date(Date.parse($("#starttime5").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        if($("#endtime5").val() != ''){
                            $("#endtime5").val(dateFormat(new Date(Date.parse($("#endtime5").val())),"yyyy-MM-dd 00:00:00"));
                        }
                        $("#starttime5").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                        $("#endtime5").attr("onfocus", "WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:00:00'})");
                    }
                };

                /*速率分析--点击节点所进行的查询的开始时间和结束时间，开始时间的初始值为所选的开始时间，
                 结束时间根据时间粒度计算*/
                var starttime5_forNode = '';
                var endtime5_forNode = ''

                /*初始化速率节点的时间*/
                var init_S_E_time = function(){
                    starttime5_forNode = ''+$('#starttime5').val();
                    endtime5_forNode = ''
                    var size_sl = $scope.timesize_sl.value;
                    switch(size_sl){
                        case '1440':
                            endtime5_forNode = starttime5_forNode;
                            break;
                        case '60':
                            endtime5_forNode = dateFormat(addMinutes(new Date(starttime5_forNode),60),'yyyy-MM-dd hh:mm');
                            break;
                        case '15':
                            endtime5_forNode = dateFormat(addMinutes(new Date(starttime5_forNode),15),'yyyy-MM-dd hh:mm');
                            break;
                        default:
                            break;
                    }
                }

                /*初始化netName2为MME*/
                $scope.netName2 = 'MME';
                /*初始化netName3为MME*/
                $scope.netName3 = 'MME';
                /*速率分析-(业务表中)所选择的业务*/
                $scope.select_service = '';

                /*---------------公共部分 ----获得群组 开始-----*/
                //获得用户组
                var getUserGroup = function(){
                    var u = httpservice.javaPost("userGroup.do?method=getUserGroup",null,function(result){
                        $scope.ztreeuser1.data = result;
                        $scope.ztreeuser2.data = result;
                        $scope.ztreeuser3.data = result;
                        $scope.ztreeuser4.data = result;
                        $scope.ztreeuser5.data = result;
                        $scope.$apply();

                    });
                }
                getUserGroup();
                //获得小区租
                var getCommGroup = function(){
                    var c = httpservice.javaPost("communityGroup.do?method=getCommGroup",null,function(result){
                        $scope.ztreecom1.data = result;
                        $scope.ztreecom2.data = result;
                        $scope.ztreecom3.data = result;
                        $scope.ztreecom4.data = result;
                        $scope.ztreecom5.data = result;
                        $scope.$apply();

                    });
                };
                getCommGroup();
                //获得终端组
                var getTerGroup = function(){
                    var t = httpservice.javaPost("terminalGroup.do?method=getTerGroup",null,function(result){
                        $scope.ztreeter1.data = result;
                        $scope.ztreeter2.data = result;
                        $scope.ztreeter3.data = result;
                        $scope.ztreeter4.data = result;
                        $scope.ztreeter5.data = result;
                        $scope.$apply();

                    });
                };
                getTerGroup();
                /*---------------公共部分 ----获得群组- 结束----*/
                /*---------------获取网络质量的查询条件-----*/
                var getCondition1 = function(){
                    var end=Date.parse($("#endtime1").val());
                    var enddate=new Date(end);
                    var temp = enddate.valueOf()+1*24*60*60*1000;
                    return {
                        nowpage:$scope.grid1.gridpagedata.nowpage,
                        pagesize:$scope.grid1.gridpagedata.pagesize,
                        interface:$scope.interface.value,
                        starttime:$('#starttime1').val(),
                        endtime:dateFormat(new Date(temp),'yyyy-MM-dd'),
                        isbusy:$('#isbusy1').is(':checked'),
                        timesize:$scope.size.value,
                        ids:$scope.currentGroup1,
                        grouptype:groupType1
                    };
                };
                /*---------------获取网络故障的查询条件----*/
                var getCondition3 = function(){

                    if($scope.timesize.value=="day"){
                        var start=Date.parse($("#starttime3").val());
                        var startdate = new Date(start);
                        var end=Date.parse($("#endtime3").val());
                        var enddate=new Date(end);
                        var temp = enddate.valueOf()+1*24*60*60*1000;
                        endtime3 = dateFormat(new Date(temp),'yyyy-MM-dd hh:mm:ss');
                        starttime3  = dateFormat(new Date(startdate.valueOf()),'yyyy-MM-dd hh:mm:ss');
                    }else{
                        starttime3=$('#starttime3').val();
                        endtime3=$("#endtime3").val();
                    }
                    //alert(starttime3+endtime3);
                    return {
                        nowpage:$scope.gridnet1.gridpagedata.nowpage,
                        pagesize:$scope.gridnet1.gridpagedata.pagesize,
                        interface:$scope.interface.value,
                        starttime:starttime3,
                        endtime:endtime3,
                        timesize:$scope.timesize.value,
                        ids:$scope.currentGroup3,
                        grouptype:groupType3,
                        even_type:$("#even_type3").val(),
                        type:$scope.netName1
                    };
                };
                //获得业务质量分析的查询条件
                var getConditionForSerQ = function(){
                    return {
                        pageindex:$scope.grid2.gridpagedata.nowpage,
                        pagesize:$scope.grid2.gridpagedata.pagesize,
                        interface:$scope.interface.value,
                        starttime:$('#starttime2').val(),
                        endtime:$('#endtime2').val(),
                        isbusy:$('#isbusy2').is(':checked'),
                        timesize:$scope.timesize_ywzl.value,
                        ids:$scope.currentGroup2,
                        groupType:groupType2
                    };
                };
                //获得业务故障分析的查询条件
                var getConditionForSerF = function(){
                    return {
                        pageindex:$scope.gridnet2.gridpagedata.nowpage,
                        pagesize:$scope.gridnet2.gridpagedata.pagesize,
                        interface:$scope.interface.value,
                        starttime:$('#starttime4').val(),
                        endtime:$('#endtime4').val(),
                        timesize:$scope.timesize_ywgz.value,
                        eventType:$('#eventType').val(),
                        ids:$scope.currentGroup4,
                        groupType:groupType4,
                        netName2:$scope.netName2
                    };
                }

                //获得速率分析的查询条件
                var getConditionForRate = function(){
                    return {
                        pageindex:$scope.gridnet3.gridpagedata.nowpage,
                        pagesize:$scope.gridnet3.gridpagedata.pagesize,
                        interface:$scope.interface.value,
                        starttime:$('#starttime5').val(),
                        endtime:$('#endtime5').val(),
                        timesize:$scope.timesize_sl.value,
                        ids:$scope.currentGroup5,
                        groupType:groupType5,
                        netName3:$scope.netName3,
                        starttime5_forNode:starttime5_forNode,
                        endtime5_forNode:endtime5_forNode,
                        select_service:$scope.select_service
                    };
                }
                /*---------------查询网络质量----*/
                $scope.getnetqulity=function(condition){
                $scope.$emit('loading', 'true');
                var url = "netqulity.do";
                var netqulity=httpservice.javaPost(url,condition,function(result){
                    $scope.grid1.gridpagedata.totalcount = result.recordCount;
                    $scope.grid1.gridpagedata.totalpage = result.pageCount;
                    $scope.grid1.gridpagedata.startline =result.startLine;
                    $scope.grid1.gridpagedata.endline = result.endLine;
                    $scope.grid1.gridpagedata.datacount = result.dataCount;
                    $scope.grid1.griddata.data = result.datas;
                    $scope.brand = result.brand;
                    $scope.endtime = result.endtime;
                    $scope.starttime = result.starttime;
                    if(result.dataCount>0){
                        netqulitydown = true;
                        netqulitycondition=result.condition;
                    }
                    $scope.$apply();
                });
                $.when(netqulity).then(function () {
                }).always(function () {
                    $scope.$emit('loading', 'false');
                    $scope.$apply();

                });
                }
                /*---------------导出网络质量详情----*/
                $scope.downnetqulity = function(){

                    if(netqulitydown==true){
                        var serviceurl= "netqulity.do?method=downfile&starttime="+netqulitycondition.starttime
                            +"&endtime="+netqulitycondition.endtime
                            +"&grouptype="+netqulitycondition.group
                            +"&isbusy="+netqulitycondition.isbusy
                            +"&ids="+netqulitycondition.ids
                            +"&timesize="+netqulitycondition.timesize;
                        var url = httpservice.javaserverurl+serviceurl;
                        window.location.href=url;


                    }else{

                        alert("无数据不能导出");
                    }
                }
                $scope.btnSearch1 = function (){
                    if($('#starttime1').val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($('#endtime1').val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime1").val())<new Date($("#starttime1").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }
                    $scope.grid1.gridpagedata.nowpage=1;
                    $scope.getnetqulity(getCondition1());
                };
                //业务质量分析------------查询
                $scope.serviceQuality = function (){
                    if($('#starttime2').val()!=""){
                        if($('#endtime2').val()!=""){
                            if(new Date($("#endtime2").val()) >= new Date($("#starttime2").val())){
                                /* if($scope.currentGroupName2 == ''){
                                 alert('群组选择不能为空');
                                 return false;
                                 }*/
                                $scope.$emit('loading','true')
                                $scope.grid2.gridpagedata.nowpage=1;
                                var f11 = $scope.querySerQue();
                                $.when(f11).then(function(){}).always(function(){
                                    $scope.$emit('loading','false')
                                    $scope.$apply();
                                });
                            }else{
                                alert('开始时间不能大于结束时间!');
                                return false;
                            }
                        }else{
                            alert('请选择结束时间!');
                            return false;
                        }
                    }else{
                        alert('请选择开始时间!');
                        return false;
                    }





                };
                //具体业务质量查询
                $scope.querySerQue = function(){
                    var condition_serq =  getConditionForSerQ()

                    return httpservice.javaPost("serviceQuality.do?method=getServiceQuality",condition_serq,function(result){
                        $scope.grid2.gridpagedata.totalcount = result.recordCount;
                        $scope.grid2.gridpagedata.totalpage = result.pageCount;
                        $scope.grid2.gridpagedata.startline = result.startLine;
                        $scope.grid2.gridpagedata.endline = result.endLine;
                        $scope.grid2.gridpagedata.datacount = result.dataCount;
                        $scope.grid2.griddata.data = result.datas;
                        $scope.$apply();
                    });
                }
                //导出业务质量分析
                $scope.exportServiceQuality = function(){
                    window.location.href = httpservice.javaserverurl+"serviceQuality.do?method=downloadAllServiceQuality"
                        + "&interface="+$scope.interface.value
                        +"&starttime="+$('#starttime2').val()
                        +"&endtime="+$('#endtime2').val()
                        +"&isbusy="+$('#isbusy2').is(':checked')
                        +"&timesize="+$scope.timesize_ywzl.value
                        +"&ids="+$scope.currentGroup2
                        +"&groupType="+encodeURI(encodeURI(groupType2));
                }
                //业务质量分析跳转页面
                $scope.turnPage_ywzl = function(){
                    $scope.querySerQue();
                }
                $scope.btnSearch3 = function (){
                    if($('#starttime3').val()==""){
                        alert('请选择开始时间!');
                        return false;
                    }
                    if($('#endtime3').val()==""){
                        alert('请选择结束时间!');
                        return false;
                    }
                    if(new Date($("#endtime3").val())<new Date($("#starttime3").val())){
                        alert('开始时间不能大于结束时间!');
                        return false;
                    }

                    var startTime = new Date($("#starttime3").val());
                    var endTime = new Date($("#endtime3").val());

                    var size = $scope.timesize.value;
                    switch(size){
                        case 'day':
                            if(getTimeDiffValue(endTime,startTime,'day')>7){
                                alert('时间范围不能超过7天!');
                                return false;
                            }
                            break;
                        case 'hour':
                            if(getTimeDiffValue(endTime,startTime,'hour')>24){
                                alert('时间范围不能超过24个小时!');
                                return false;
                            }
                            break;
                        case 'fifteenmin':
                            if(getTimeDiffValue(endTime,startTime,'hour')>5){
                                alert('时间范围不能超过5个小时!');
                                return false;
                            }
                            break;
                        default:
                            break;
                    }
                    if($scope.currentGroup3==""){
                        alert(" 组不能为空");
                        return false;
                    }
                 $scope.getnetinfo(getCondition3());
                };

                $scope.clearAll = function(){
                    var title = $('#even_type3 option:selected').text()+"指标趋势";
                    var title1 = $('#even_type3 option:selected').text()+"故障原因归类分布";
                    $scope.highchartyy1.chartdata.series = [];
                    $scope.highchartyy1.chartdata.title.text = title;
                    $scope.highchartyy1.chartdata.xAxis.categories = [];
                    $scope.highchartcolumn1.chartdata.series = [];
                    $scope.highchartcolumn1.chartdata.series = [];
                    $scope.highchartcolumn1.chartdata.title.text = title1;
                    $scope.highchartcolumn1.chartdata.xAxis.categories=[];
                    $scope.highchartpie1.chartdata.series = [];
                    $scope.grid3.griddata.data = [];
                    $scope.gridnet1.griddata.data = [];
                    //$scope.$apply();
                }

                $scope.clearAllService = function(){
                    var title = $('#eventType option:selected').text()+"指标趋势";
                    var title1 = $('#eventType option:selected').text()+"故障原因归类分布";
                    $scope.highchartyy2.chartdata.series = [];
                    $scope.highchartyy2.chartdata.title.text = title;
                    $scope.highchartyy2.chartdata.xAxis.categories = [];
                    $scope.highchartcolumn2.chartdata.series = [];
                    $scope.highchartcolumn2.chartdata.series = [];
                    $scope.highchartcolumn2.chartdata.title.text = title1;
                    $scope.highchartcolumn2.chartdata.xAxis.categories=[];
                    $scope.highchartpie2.chartdata.series = [];
                    $scope.grid4.griddata.data = [];
                    $scope.gridnet2.griddata.data = [];
                    //$scope.$apply();
                }
                $scope.getnetinfo=function(condition){
                    $scope.$emit('loading', 'true');
                    $scope.clearAll();
                    var f1=getnetrequest(getCondition3());
                    var f2=getnetreason(getCondition3());
                    var f3 = getnetfailure(getCondition3());
                    var f4 = getnetdetail(getCondition3());
                    $.when(f1,f2,f3,f4).then(function () {
                    }).always(function () {
                        $scope.$emit('loading', 'false');
                        $scope.$apply();
                    });
                };
                //业务故障查询
                $scope.serviceFailure = function (){
                    if($('#starttime4').val()!=""){
                        if($('#endtime4').val()!=""){
                            if(new Date($("#endtime4").val())>=new Date($("#starttime4").val())){
                               /* if($scope.currentGroupName4 == ''){
                                    alert('群组选择不能为空');
                                    return false;
                                }*/
                                /*对输入的时间间隔进行限制 start*/
                                var startTime = new Date($("#starttime4").val());
                                var endTime = new Date($("#endtime4").val());

                                var size = $scope.timesize_ywgz.value;
                                switch(size){
                                    case '1440':
                                        if(getTimeDiffValue(endTime,startTime,'day')>7){
                                            alert('时间范围不能超过7天!');
                                            return false;
                                        }
                                        break;
                                    case '60':
                                        if(getTimeDiffValue(endTime,startTime,'hour')>24){
                                            alert('时间范围不能超过24个小时!');
                                            return false;
                                        }
                                        break;
                                    case '15':
                                        if(getTimeDiffValue(endTime,startTime,'hour')>5){
                                            alert('时间范围不能超过5个小时!');
                                            return false;
                                        }
                                        break;
                                    default:
                                        break;
                                }
                                /*对输入的时间间隔进行限制 end*/

                                $scope.$emit('loading','true')
                                $scope.clearAllService();
                                var f11 = $scope.querySerFau();
                                $.when(f11).then(function(){}).always(function(){
                                    $scope.$emit('loading','false')
                                    $scope.$apply();
                                });

                            }else{
                                alert('开始时间不能大于结束时间!');
                                return false;
                            }
                        }else{
                            alert('请选择结束时间!');
                            return false;
                        }
                    }else{
                        alert('请选择开始时间!');
                        return false;
                    }

                };

                //具体业务故障查询
                $scope.querySerFau = function(){
                    var condition_serf =  getConditionForSerF();

                    return httpservice.javaPost("serviceFailure.do?method=getServiceFailure",condition_serf,function(result){
                        /*EPS附着指标趋势图 start*/
                        $scope.highchartyy2.chartdata.xAxis.categories = result.chart_cate1;
                        var chart1_series1 = {
                            name: '请求次数',
                            color: '#4572A7',
                            type: 'spline',
                            data: result.chart1_series1,
                            tooltip: {
                                valueSuffix: '次'
                            }
                        };
                        var chart1_series2 = {
                            name: '成功率',
                            color: '#89A54E',
                            type: 'spline',
                            yAxis: 1,
                            data: result.chart1_series2,
                            tooltip: {
                                valueSuffix: '%'
                            }

                        };
                        $scope.highchartyy2.chartdata.series = [chart1_series1,chart1_series2];
                        /*EPS附着指标趋势图 end*/

                        /*EPS附着故障原因归类分布图 start*/
                        $scope.highchartcolumn2.chartdata.xAxis.categories = result.chart_cate2;

                        var chart2_series1 = {
                            name: '网络原因',
                            data: result.chart2_series1
                        };
                        var chart2_series2 = {
                            name: '用户原因',
                            data: result.chart2_series2
                        };
                        var chart2_series3 = {
                            name: '服务提供商原因',
                            data: result.chart2_series3
                        }

                        $scope.highchartcolumn2.chartdata.series = [chart2_series1,chart2_series2,chart2_series3];
                        /*EPS附着故障原因归类分布图 end*/

                        /*图显示 start*/
                        var chart3_series1 = {
                            name: '故障详细',
                            data: result.chart3_series2,
                            cursor: 'pointer',
                            size: '130%'
                        };
                        var chart3_series2 = {
                            name: '故障分类',
                            data: result.chart3_series1,
                            cursor: 'pointer',
                            size: '105%',
                            dataLabels: {
                            color: 'white',
                                distance: -30
                            }
                        };
                        $scope.highchartpie2.chartdata.series = [chart3_series1,chart3_series2];
                        /*图显示 end*/

                        /*表显示 start*/
                        $scope.grid4.griddata.data = result.table_data1;
                        /*表显示 end*/

                        /*MME TAI eNodeB ECGE APN 表 start*/
                        $scope.gridnet2.gridpagedata.totalcount = result.recordCount;
                        $scope.gridnet2.gridpagedata.totalpage = result.totalPage;
                        $scope.gridnet2.gridpagedata.startline =result.startLine;
                        $scope.gridnet2.gridpagedata.endline = result.endLine;
                        $scope.gridnet2.gridpagedata.datacount = result.dataCount;
                        $scope.gridnet2.griddata.data = result.table_data2;
                        /*MME TAI eNodeB ECGE APN 表 end*/
                        $scope.$apply();
                    });
                }

                /*业务故障分析跳转TAB页面*/
                $scope.tabChange = function(e){
                    $scope.$emit('loading','true');
                    /*更改表字段名称*/
                    $scope.netName2 = e;
                    $scope.gridnet2.griddata.colnames = [$scope.netName2,'请求次数','失败次数','比例'];
                    /*更新表内容*/
                    var condition_serf =  getConditionForSerF();
                    var f11 = httpservice.javaPost("serviceFailure.do?method=tabChange",condition_serf,function(result){
                        /*MME TAI eNodeB ECGE APN 表 start*/
                        $scope.gridnet2.gridpagedata.totalcount = result.recordCount;
                        $scope.gridnet2.gridpagedata.totalpage = result.totalPage;
                        $scope.gridnet2.gridpagedata.startline =result.startLine;
                        $scope.gridnet2.gridpagedata.endline = result.endLine;
                        $scope.gridnet2.gridpagedata.datacount = result.dataCount;
                        $scope.gridnet2.griddata.data = result.table_data2;
                        /*MME TAI eNodeB ECGE APN 表 end*/
                        $scope.$apply();
                    });
                    $.when(f11).then(function(){}).always(function(){
                        $scope.$emit('loading','false')
                        $scope.$apply();
                    });

                }
                /*速率分析跳转TAB页面*/
                $scope.tabChange_sl = function(e){
                    $scope.$emit('loading','true');
                    /*更改表字段名称*/
                    $scope.netName3 = e;
                    $scope.gridnet3.griddata.colnames = [$scope.netName3,'流量(MB)','速率(Mbps)','请求次数','上行重传率','下行重传率'];
                    /*更新表内容*/
                    /*MME TAI eNodeB ECGE APN 表 */
                    var MME_TAI_eNodeB_ECGE_APN = getMME_TAI_eNodeB_ECGE_APN();
                    $.when(MME_TAI_eNodeB_ECGE_APN).then(function(){}).always(function(){
                        $scope.$emit('loading','false')
                        $scope.$apply();
                    });

                }

                /*导出业务故障分析“表显示”的数据*/
                $scope.exportFailureTable1 = function(){
                    window.location.href = httpservice.javaserverurl+"serviceFailure.do?method=exportFailureTable1"
                        + "&interface="+$scope.interface.value
                        +"&starttime="+$('#starttime4').val()
                        +"&endtime="+$('#endtime4').val()
                        +"&eventType="+$('#eventType').val()
                        +"&ids="+$scope.currentGroup4
                        +"&groupType="+encodeURI(encodeURI(groupType4));
                }
                /*导出业务故障分析MME TAI ENODEB ECGE APN表的数据*/
                $scope.exportFailureTable2 = function(){
                    window.location.href = httpservice.javaserverurl+"serviceFailure.do?method=exportFailureTable2"
                        + "&interface="+$scope.interface.value
                        +"&starttime="+$('#starttime4').val()
                        +"&endtime="+$('#endtime4').val()
                        +"&eventType="+$('#eventType').val()
                        +"&ids="+$scope.currentGroup4
                        +"&groupType="+encodeURI(encodeURI(groupType4))
                        +"&netName2="+$scope.netName2;
                }

                //速率分析查询
                $scope.rateAnalysis = function (){
                    if($('#starttime5').val()!=""){
                        if($('#endtime5').val()!=""){
                            if(new Date($("#endtime5").val())>=new Date($("#starttime5").val())){
                                /* if($scope.currentGroupName4 == ''){
                                 alert('群组选择不能为空');
                                 return false;
                                 }*/

                                /*对输入的时间间隔进行限制 start*/
                                var startTime = new Date($("#starttime5").val());
                                var endTime = new Date($("#endtime5").val());

                                var size = $scope.timesize_sl.value;
                                switch(size){
                                    case '1440':
                                        if(getTimeDiffValue(endTime,startTime,'day')>7){
                                            alert('时间范围不能超过7天!');
                                            return false;
                                        }
                                        break;
                                    case '60':
                                        if(getTimeDiffValue(endTime,startTime,'hour')>24){
                                            alert('时间范围不能超过24个小时!');
                                            return false;
                                        }
                                        break;
                                    case '15':
                                        if(getTimeDiffValue(endTime,startTime,'hour')>5){
                                            alert('时间范围不能超过5个小时!');
                                            return false;
                                        }
                                        break;
                                    default:
                                        break;
                                }
                                /*对输入的时间间隔进行限制 end*/

                                $scope.$emit('loading','true')
                                var f11 = $scope.queryRate();
                                $.when(f11).then(function(){}).always(function(){
                                    $scope.$emit('loading','false')
                                });

                            }else{
                                alert('开始时间不能大于结束时间!');
                                return false;
                            }
                        }else{
                            alert('请选择结束时间!');
                            return false;
                        }
                    }else{
                        alert('请选择开始时间!');
                        return false;
                    }
                };

                //具体速率分析查询
                $scope.queryRate = function(){

                    /*EPS附着指标趋势图 */
                    var RateEPS = getRateEPS();
                    /*业务-速率分析表 */
                    $.when(RateEPS).then(function () {
                        var init_S_E = init_S_E_time();
                        $.when(init_S_E).then(function () {
                            var ServiceRate = getServiceRate();
                            $.when(ServiceRate).then(function () {
                                if($scope.grid5.griddata.data !=''){
                                    /*获得当前第一条记录的业务类型编号,并给$scope.select_service赋值*/
                                    $scope.select_service = $scope.grid5.griddata.data[0]["service_type_code"];
                                    /*SP(子业务)-速率分析表 */
                                    var SubServiceRate = getSubServiceRate();
                                    /*MME TAI eNodeB ECGE APN 表 */
                                    var MME_TAI_eNodeB_ECGE_APN = getMME_TAI_eNodeB_ECGE_APN();
                                }else{
                                    $scope.grid6.griddata.data = [];
                                    $scope.gridnet3.gridpagedata.totalcount = 0;
                                    $scope.gridnet3.gridpagedata.totalpage = 0;
                                    $scope.gridnet3.gridpagedata.startline =0;
                                    $scope.gridnet3.gridpagedata.endline = 0;
                                    $scope.gridnet3.gridpagedata.datacount = 0;
                                    $scope.gridnet3.griddata.data = [];0

                                    $scope.$apply();

                                }

                            });
                        });


                    });



                }
                /*EPS附着指标趋势图 */
                var getRateEPS = function(){
                    var condition_rate =  getConditionForRate();
                    return httpservice.javaPost("rateAnalysis.do?method=getRateEPS",condition_rate,function(result){
                        /*EPS附着指标趋势图 start*/
                        $scope.highchartyy3.chartdata.xAxis.categories = result.chart_cate1;
                        var chart1_series1 = {
                            name: '流量',
                            color: '#4572A7',
                            type: 'spline',
                            data: result.chart1_series1,
                            tooltip: {
                                valueSuffix: 'MB'
                            }
                        };
                        var chart1_series2 = {
                            name: '平均速率',
                            color: '#89A54E',
                            type: 'spline',
                            yAxis: 1,
                            data: result.chart1_series2,
                            tooltip: {
                                valueSuffix: 'Kbps'
                            }

                        };
                        $scope.highchartyy3.chartdata.series = [chart1_series1,chart1_series2];
                        /*EPS附着指标趋势图 end*/

                        $scope.$apply();

                    });
                }
                /*业务-速率分析表 */
                var getServiceRate = function(){
                    var condition_rate =  getConditionForRate();
                    return httpservice.javaPost("rateAnalysis.do?method=getServiceRate",condition_rate,function(result){
                        /*业务-速率分析表 start*/
                        $scope.grid5.griddata.data = result.table_data1;
                        /*业务-速率分析表 end*/

                        $scope.$apply();
                    });
                }
                /*SP(子业务)-速率分析表 */
                var getSubServiceRate = function(){
                    var condition_rate =  getConditionForRate();
                    return httpservice.javaPost("rateAnalysis.do?method=getSubServiceRate",condition_rate,function(result){
                        /*SP(子业务)-速率分析表 start*/
                        $scope.grid6.griddata.data = result.table_data2;
                        /*SP(子业务)-速率分析表 end*/

                        $scope.$apply();
                    });
                }
                /*MME TAI eNodeB ECGE APN 表 */
                var getMME_TAI_eNodeB_ECGE_APN = function(){
                    var condition_rate =  getConditionForRate();
                    return httpservice.javaPost("rateAnalysis.do?method=getMME_TAI_eNodeB_ECGE_APN",condition_rate,function(result){

                        /*MME TAI eNodeB ECGE APN 表 start*/
                        $scope.gridnet3.gridpagedata.totalcount = result.recordCount;
                        $scope.gridnet3.gridpagedata.totalpage = result.totalPage;
                        $scope.gridnet3.gridpagedata.startline =result.startLine;
                        $scope.gridnet3.gridpagedata.endline = result.endLine;
                        $scope.gridnet3.gridpagedata.datacount = result.dataCount;
                        $scope.gridnet3.griddata.data = result.table_data3;
                        /*MME TAI eNodeB ECGE APN 表 end*/

                        $scope.$apply();

                    });
                }
                /*导出业务——速率分析表*/
                $scope.exportRateTable1 = function(){
                    window.location.href = httpservice.javaserverurl+"rateAnalysis.do?method=exportRateTable1"
                        + "&interface="+$scope.interface.value
                        +"&starttime="+starttime5_forNode
                        +"&endtime="+endtime5_forNode
                        +"&ids="+$scope.currentGroup5
                        +"&groupType="+encodeURI(encodeURI(groupType5));
                }
                /*导出SP(子业务)——速率分析表*/
                $scope.exportRateTable2 = function(){
                    window.location.href = httpservice.javaserverurl+"rateAnalysis.do?method=exportRateTable2"
                        + "&interface="+$scope.interface.value
                        +"&starttime="+starttime5_forNode
                        +"&endtime="+endtime5_forNode
                        +"&ids="+$scope.currentGroup5
                        +"&groupType="+encodeURI(encodeURI(groupType5))
                        +"&select_service="+$scope.select_service;
                }
                /*导出MME TAI eNodeB ECGE APN 表*/
                $scope.exportRateTable3 = function(){
                    window.location.href = httpservice.javaserverurl+"rateAnalysis.do?method=exportRateTable3"
                        + "&interface="+$scope.interface.value
                        +"&starttime="+starttime5_forNode
                        +"&endtime="+endtime5_forNode
                        +"&ids="+$scope.currentGroup5
                        +"&groupType="+encodeURI(encodeURI(groupType5))
                        +"&select_service="+$scope.select_service
                        +"&netName3="+$scope.netName3;
                }

                $scope.queryData1 = function(){
                    $scope.$emit('loading', 'true');
                    $scope.$apply();
                    var condition = getCondition1();
                    var f = getNetWorkIndicatorsList(condition);
                    $.when(f).then(function () {
                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });
                };
                var getNetWorkIndicatorsList = function(condition){
                    return httpservice.post("script/NetPerception/GetNetWorkIndicatorsList",JSON.stringify(postdata),function(result){
                        $scope.grid1.gridpagedata.totalcount = result.recordCount;
                        $scope.grid1.gridpagedata.totalpage = result.pageCount;
                        $scope.grid1.gridpagedata.startline = result.startLine;
                        $scope.grid1.gridpagedata.endline = result.endLine;
                        $scope.grid1.gridpagedata.datacount = result.dataCount;
                        $scope.grid1.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                 //获取不同类型的请求的请求数量和成功率
                var getnetrequest = function(condition){
                    var url = "netfailure.do?method=getrequestcount";
                    httpservice.javaPost(url,condition,function(result){
                        var title = $('#even_type3 option:selected').text()+"指标趋势";
                        var data1 = result.counts,
                            data2 = result.ratios;
                        var series0=
                        {
                            name: '请求次数',
                            color: '#4572A7',
                            type: 'spline',

                            data: data1,
                            tooltip: {
                                valueSuffix: '次'
                            }
                        };
                        var series1=
                        {
                            name: '成功率',
                            color: '#89A54E',
                            type: 'spline',
                            yAxis: 1,
                            data: data2,
                            tooltip: {
                                valueSuffix: '%'
                            }
                        };
                        //$scope.highchartyy1.chartdata.series = [];
                            $scope.highchartyy1.chartdata.series = [series0,series1];
                        $scope.highchartyy1.chartdata.title.text = title;
                        $scope.highchartyy1.chartdata.xAxis.categories = result.periods1;

                        $scope.$apply();
                    });
                    //return httpservice.post("script/NetPerception/GetBusinessFaultTrend",JSON.stringify(postdata),);
                };
                //获取网络故障原因情况
                var getnetreason = function(condition){
                    var url = "netfailure.do?method=getreason";
                    return httpservice.javaPost(url,condition,function(result){
                        var title = $('#even_type3 option:selected').text()+"故障原因归类分布";
                        var netData = result.netcount,
                            userData = result.usercount,
                            spData = result.servicescounts;
                        var series0=
                        {
                            name: '网络原因',
                            data: netData

                        };
                        var series1=
                        {
                            name: '用户原因',
                            data: userData

                        };
                        var series2=
                        {
                            name: '服务商原因',
                            data: spData

                        };
                        $scope.highchartcolumn1.chartdata.series = [];

                            $scope.highchartcolumn1.chartdata.series = [series0,series1,series2];


                        $scope.highchartcolumn1.chartdata.title.text = title;
                        $scope.highchartcolumn1.chartdata.xAxis.categories=result.periods2;

                        $scope.$apply();
                    });
                };
                //获取不同的网络故障占比
                var getnetfailure = function(condition){
                    var url = "netfailure.do?method=getfailure"
                    return httpservice.javaPost(url,condition,function(result){
                        var classData = [],detailData = [];
                        for(var i=0;i<result.reason.length;i++){
                            var item = {};
                            item.name = result.reason[i].reasontype;
                            item.y = result.reason[i].count;
                            classData[i] = item;
                        }
                        for(var j=0;j<result.details.length;j++){
                            var jtem = {};
                            jtem.name = result.details[j].maldetail;
                            jtem.y = result.details[j].failcount;
                            detailData[j] = jtem;
                        }

                        var series0={
                            name: '故障详细',
                            data:detailData,
                            cursor: 'pointer',
                            size: '130%'
                        };
                        var series1=
                        {
                            name: '故障分类',
                            data:classData,
                            cursor: 'pointer',
                            size: '105%',
                            dataLabels: {
                                color: 'white',
                                distance: -30
                            }
                        }
                        $scope.highchartpie1.chartdata.series = [];
                        if(detailData.length>0)
                        {
                            $scope.highchartpie1.chartdata.series = [series0,series1];
                            $scope.failurratiodown=true;
                            $scope.failurratio=result.condition;
                        }
                        $scope.grid3.griddata.data = result.datas;
                        $scope.$apply();
                    });
                };
                //不同的网络指标详情
                var getnetdetail = function(condition){
                    var url ="netfailure.do?method=getnetinfo";
                    return httpservice.javaPost(url,condition,function(result){
                        $scope.gridnet1.gridpagedata.totalcount = result.recordCount;
                        $scope.gridnet1.gridpagedata.totalpage = result.totalPage;
                        $scope.gridnet1.gridpagedata.startline =result.startLine;
                        $scope.gridnet1.gridpagedata.endline = result.endLine;
                        $scope.gridnet1.gridpagedata.datacount = result.dataCount;
                        $scope.gridnet1.griddata.data = result.datas;
                        if(result.recordCount>0){
                            $scope.netdetailconditiondown=true;
                            $scope.netdetailcondition=result.condition;
                        }
                        $scope.$apply();
                    });
                };
                //导出网络详细故障的详情
                $scope.downnetfailure=function(){
                    if($scope.failurratiodown==false){
                        alert("无数据下载");
                        return false;
                    }else if($scope.failurratiodown==true){
                        var url = "netfailure.do?method=downfailure&starttime="+$scope.failurratio.starttime+"&endtime="
                            +$scope.failurratio.endtime+"&grouptype="+$scope.failurratio.group+"&even_type="
                            +$scope.failurratio.even_type+"&ids="+$scope.failurratio.ids;
                        window.location.href=httpservice.javaserverurl+url;
                    }
                };
                //导出（mme,tai,enodeb,ecgi,apn）指标详情
                $scope.downnetdetail=function(){
                    if($scope.netdetailconditiondown==false){
                        alert("无数据下载");
                        return false;
                    }else if($scope.netdetailconditiondown==true){
                        var url = "netfailure.do?method=downnetinfo&starttime="+$scope.netdetailcondition.starttime+"&endtime="
                            +$scope.netdetailcondition.endtime+"&grouptype="+$scope.netdetailcondition.group+"&even_type="
                            +$scope.netdetailcondition.even_type+"&ids="+$scope.netdetailcondition.ids+"&type="
                            +$scope.netdetailcondition.type;
                        window.location.href=httpservice.javaserverurl+url;
                    }

                };

                $scope.turnPage1= function(){
                    $scope.queryData1();
                };
                $scope.currentTab1 = '用户组';
                $scope.currentGroup1 = '';
                $scope.currentGroupName1 = '';
                $scope.treeID1 = 'ztreeuser';
                $scope.group1 = {
                    title: "群组选择",
//                    show: function () { },
                    ok: function () {
                        switch ($scope.currentTab1){
                            case '用户组':
                                $scope.treeID1 = 'ztreeuser1';
                                break;
                            case '小区组':
                                $scope.treeID1 = 'ztreecom1';
                                break;
                            case '终端组':
                                $scope.treeID1 = 'ztreeter1';
                                break;
                            default :
                                break;
                        }
                        var treeObj1 = $.fn.zTree.getZTreeObj($scope.treeID1);
                        var nodes1 = treeObj1.getCheckedNodes();

                        $scope.currentGroup1 = '';
                        $scope.currentGroupName1 = '';
                        if(nodes1!=null&&nodes1.length>0){
                            for(var i=0;i<nodes1.length;i++){
                                $scope.currentGroup1+=nodes1[i].id+',';
                                $scope.currentGroupName1 +=nodes1[i].name+',';
                            }
                            if($scope.currentGroup1.length > 0){
                                $scope.currentGroup1 = $scope.currentGroup1.substring(0,$scope.currentGroup1.length-1);
                                $scope.currentGroupName1 = $scope.currentGroupName1.substring(0,$scope.currentGroupName1.length-1);
                            }
                        }
                        groupType1 = $scope.currentTab1;

                    },
                    cancel: function () { }
                };
                $scope.currentTab2 = '用户组';
                $scope.currentGroup2 = '';
                $scope.currentGroupName2 = '';
                $scope.treeID2 = 'ztreeuser2';
                $scope.group2 = {
                    title: "群组选择",
//                    show: function () { },
                    ok: function () {
                        switch ($scope.currentTab2){
                            case '用户组':
                                $scope.treeID2 = 'ztreeuser2';
                                break;
                            case '小区组':
                                $scope.treeID2 = 'ztreecom2';
                                break;
                            case '终端组':
                                $scope.treeID2 = 'ztreeter2';
                                break;
                            default :
                                break;
                        }
                        var treeObj2 = $.fn.zTree.getZTreeObj($scope.treeID2);
                        var nodes2 = treeObj2.getCheckedNodes();
                        $scope.currentGroup2 = '';
                        $scope.currentGroupName2 = '';
                        if(nodes2!=null&&nodes2.length>0){
                            for(var i=0;i<nodes2.length;i++){
                                $scope.currentGroup2+=nodes2[i].id+',';
                                $scope.currentGroupName2 +=nodes2[i].name+',';
                            }
                            if($scope.currentGroup2.length > 0){
                                $scope.currentGroup2 = $scope.currentGroup2.substring(0,$scope.currentGroup2.length-1);
                                $scope.currentGroupName2 = $scope.currentGroupName2.substring(0,$scope.currentGroupName2.length-1);
                            }
                        }
                        groupType2 = $scope.currentTab2;

                    },
                    cancel: function () { }
                };
                $scope.currentTab3 = '用户组';
                $scope.currentGroup3 = '';
                $scope.currentGroupName3 = '';
                $scope.treeID3 = 'ztreeuser3';
                $scope.group3 = {
                    title: "群组选择",
//                    show: function () { },
                    ok: function () {
                        switch ($scope.currentTab3){
                            case '用户组':
                                $scope.treeID3 = 'ztreeuser3';
                                break;
                            case '小区组':
                                $scope.treeID3 = 'ztreecom3';
                                break;
                            case '终端组':
                                $scope.treeID3 = 'ztreeter3';
                                break;
                            default :
                                break;
                        }
                        var treeObj3 = $.fn.zTree.getZTreeObj($scope.treeID3);
                        var nodes3 = treeObj3.getCheckedNodes();
                        $scope.currentGroup3 = '';
                        $scope.currentGroupName3 = '';
                        if(nodes3!=null&&nodes3.length>0){
                            for(var i=0;i<nodes3.length;i++){
                                $scope.currentGroup3+=nodes3[i].id+',';
                                $scope.currentGroupName3 +=nodes3[i].name+',';
                            }
                            if($scope.currentGroup3.length > 0){
                                $scope.currentGroup3 = $scope.currentGroup3.substring(0,$scope.currentGroup3.length-1);
                                $scope.currentGroupName3 = $scope.currentGroupName3.substring(0,$scope.currentGroupName3.length-1);
                            }
                        }
                        groupType3 = $scope.currentTab3;
                        //alert(groupType3+":"+$scope.currentGroup3);
                    },
                    cancel: function () { }
                };
                $scope.currentTab4 = '用户组';
                $scope.currentGroup4 = '';
                $scope.currentGroupName4 = '';
                $scope.treeID4 = 'ztreeuser4';
                $scope.group4 = {
                    title: "群组选择",
//                    show: function () { },
                    ok: function () {
                        switch ($scope.currentTab4){
                            case '用户组':
                                $scope.treeID4 = 'ztreeuser4';
                                break;
                            case '小区组':
                                $scope.treeID4 = 'ztreecom4';
                                break;
                            case '终端组':
                                $scope.treeID4 = 'ztreeter4';
                                break;
                            default :
                                break;
                        }
                        var treeObj4 = $.fn.zTree.getZTreeObj($scope.treeID4);
                        var nodes4 = treeObj4.getCheckedNodes();
                        $scope.currentGroup4 = '';
                        $scope.currentGroupName4 = '';
                        if(nodes4!=null&&nodes4.length>0){
                            for(var i=0;i<nodes4.length;i++){
                                $scope.currentGroup4+=nodes4[i].id+',';
                                $scope.currentGroupName4+=nodes4[i].name+',';
                            }
                            if($scope.currentGroup4.length > 0){
                                $scope.currentGroup4 = $scope.currentGroup4.substring(0,$scope.currentGroup4.length-1);
                                $scope.currentGroupName4 = $scope.currentGroupName4.substring(0,$scope.currentGroupName4.length-1);
                            }
                        }
                        groupType4 = $scope.currentTab4;

                    },
                    cancel: function () { }
                };
                $scope.currentTab5 = '用户组';
                $scope.currentGroup5 = '';
                $scope.currentGroupName5 = '';
                $scope.treeID5 = 'ztreeuser5';
                $scope.group5 = {
                    title: "群组选择",
//                    show: function () { },
                    ok: function () {
                        switch ($scope.currentTab5){
                            case '用户组':
                                $scope.treeID5 = 'ztreeuser5';
                                break;
                            case '小区组':
                                $scope.treeID5 = 'ztreecom5';
                                break;
                            case '终端组':
                                $scope.treeID5 = 'ztreeter5';
                                break;
                            default :
                                break;
                        }
                        var treeObj5 = $.fn.zTree.getZTreeObj($scope.treeID5);
                        var nodes5 = treeObj5.getCheckedNodes();
                        $scope.currentGroup5 = '';
                        $scope.currentGroupName5 = '';
                        if(nodes5!=null&&nodes5.length>0){
                            for(var i=0;i<nodes5.length;i++){
                                $scope.currentGroup5+=nodes5[i].id+',';
                                $scope.currentGroupName5+=nodes5[i].name+',';
                            }
                            if($scope.currentGroup5.length > 0){
                                $scope.currentGroup5 = $scope.currentGroup5.substring(0,$scope.currentGroup5.length-1);
                                $scope.currentGroupName5 = $scope.currentGroupName5.substring(0,$scope.currentGroupName5.length-1);
                            }
                        }
                        groupType5 = $scope.currentTab5;

                    },
                    cancel: function () { }
                };
                $scope.ztreeuser1 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '用户1'},
                        { id: 2, name: '用户2'},
                        { id: 3, name: '用户3'}
                    ]
                };
                $scope.ztreeuser2 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '用户1'},
                        { id: 2, name: '用户2'},
                        { id: 3, name: '用户3'}
                    ]
                };
                $scope.ztreeuser3 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '用户1'},
                        { id: 2, name: '用户2'},
                        { id: 3, name: '用户3'}
                    ]
                };
                $scope.ztreeuser4 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '用户1'},
                        { id: 2, name: '用户2'},
                        { id: 3, name: '用户3'}
                    ]
                };
                $scope.ztreeuser5 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '用户1'},
                        { id: 2, name: '用户2'},
                        { id: 3, name: '用户3'}
                    ]
                };
                $scope.ztreecom1 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '小区1'},
                        { id: 2, name: '小区2'},
                        { id: 3, name: '小区3'}
                    ]
                };
                $scope.ztreecom2 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '小区1'},
                        { id: 2, name: '小区2'},
                        { id: 3, name: '小区3'}
                    ]
                };
                $scope.ztreecom3 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '小区1'},
                        { id: 2, name: '小区2'},
                        { id: 3, name: '小区3'}
                    ]
                };
                $scope.ztreecom4 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '小区1'},
                        { id: 2, name: '小区2'},
                        { id: 3, name: '小区3'}
                    ]
                };
                $scope.ztreecom5 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '小区1'},
                        { id: 2, name: '小区2'},
                        { id: 3, name: '小区3'}
                    ]
                };
                $scope.ztreeter1 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '终端1'},
                        { id: 2, name: '终端2'},
                        { id: 3, name: '终端3'}
                    ]
                };
                $scope.ztreeter2 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '终端1'},
                        { id: 2, name: '终端2'},
                        { id: 3, name: '终端3'}
                    ]
                };
                $scope.ztreeter3 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '终端1'},
                        { id: 2, name: '终端2'},
                        { id: 3, name: '终端3'}
                    ]
                };
                $scope.ztreeter4 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '终端1'},
                        { id: 2, name: '终端2'},
                        { id: 3, name: '终端3'}
                    ]
                };
                $scope.ztreeter5 = {
                    obj: "",
                    filter: "",
//                    tofilter: function () { },
                    data: [
                        { id: 1, name: '终端1'},
                        { id: 2, name: '终端2'},
                        { id: 3, name: '终端3'}
                    ]
                };
                $scope.setTabs1 = function(value){
                    $scope.currentTab1 = value;
                };
                $scope.setTabs2 = function(value){
                    $scope.currentTab2 = value;
                };
                $scope.setTabs3 = function(value){
                    $scope.currentTab3 = value;
                };
                $scope.setTabs4 = function(value){
                    $scope.currentTab4 = value;
                };
                $scope.setTabs5 = function(value){
                    $scope.currentTab5 = value;
                };
                $scope.grid1 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.getnetqulity(getCondition1());
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.getnetqulity(getCondition1());
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.getnetqulity(getCondition1());
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.getnetqulity(getCondition1());
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.getnetqulity(getCondition1());
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.getnetqulity(getCondition1());
                        }
                    },
                    griddata: {
                        colnames: ['时间段','网元','attach请求次数','attach请求成功次数','attach成功率','pdn连接次数','pdn连接成功次数','pdn连接成功率',"tau请求次数","tau请求成功次数","tau请求成功率"],
                        colmodel: [
                            { name: 'date_time', index: 'date_time', sortable: false, align:"center"},
                            { name: 'network', index: 'network', sortable: false, align:"center"},
                            { name: 'attachcount', index: 'attachcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'attachsuccount', index: 'attachsuccount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'attachsucpct', index: 'attachsucpct', sortable: false, align:"center"},
                            { name: 'pdnconcount', index: 'pdnconcount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'pdnconsuccount', index: 'pdnconsuccount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'pdnconsucpct', index: 'pdnconsucpct', sortable: true, align:"center"},
                            { name: 'taucount', index: 'taucount', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'tausuccount', index: 'tausuccount', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'tausucpct', index: 'tausucpct', sortable: true, align:"center"}
                        ],
                        data: [
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()-23);
                        grid.setGridHeight(300);
                    }
                };
                $scope.grid2 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid2.gridpagedata.nowpage = 1;
                            $scope.turnPage_ywzl();
                        },
                        toToppage: function(){
                            if($scope.grid2.gridpagedata.nowpage>1){
                                $scope.grid2.gridpagedata.nowpage--;
                            }
                            $scope.turnPage_ywzl();
                        },
                        toNextpage: function(){
                            if($scope.grid2.gridpagedata.nowpage<$scope.grid2.gridpagedata.totalpage){
                                $scope.grid2.gridpagedata.nowpage++;
                            }
                            $scope.turnPage_ywzl();
                        },
                        toLastpage: function(){
                            $scope.grid2.gridpagedata.nowpage = $scope.grid2.gridpagedata.totalpage;
                            $scope.turnPage_ywzl();
                        },
                        topage: function(){
                            if($scope.grid2.gridpagedata.nowpage<1){
                                $scope.grid2.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid2.gridpagedata.nowpage>$scope.grid2.gridpagedata.totalpage){
                                $scope.grid2.gridpagedata.nowpage = $scope.grid2.gridpagedata.totalpage;
                            }
                            $scope.turnPage_ywzl();
                        },
                        changePagesize: function(){
                            $scope.grid2.gridpagedata.nowpage = 1;
                            $scope.turnPage_ywzl();
                        }
                    },
                    griddata: {
                        colnames: ['时间段','网元','TCP连接请求次数','TCP连接请求成功次数','TCP连接成功率','DNS查询请求次数','DNS查询请求成功次数','DNS查询成功率',"HTTP业务请求次数 ","HTTP业务请求成功次数","HTTP业务请求成功率"],
                        colmodel: [
                            { name: 'date_time', index: 'date_time', sortable: false, align:"center"},
                            { name: 'network', index: 'network', sortable: false, align:"center"},
                            { name: 'tcp_count', index: 'tcp_count', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'tcp_succount', index: 'tcp_succount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'tcp_sucpct', index: 'tcp_sucpct', sortable: false, align:"center"},
                            { name: 'dns_concount', index: 'dns_concount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'dns_consuccount', index: 'dns_consuccount', sortable: true,  sorttype: 'number', align:"center"},
                            { name: 'dns_consucpct', index: 'dns_consucpct', sortable: true, align:"center"},
                            { name: 'http_count', index: 'http_count', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'http_succount', index: 'http_succount', sortable: true, sorttype: 'number', align:"center"},
                            { name: 'http_sucpct', index: 'http_sucpct', sortable: true, align:"center"}
                        ],
                        data: [
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"},
//                            { "time": "2015/9/3 17:00", "network": "iPhone6S", "attachn": "1000", "attach": "22.22%", "pdnn": "1000", "pdn": "88.88%", "taun": "1000", "tau": "88.88%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()-23);
                        grid.setGridHeight(300);
                    }
                };
                $scope.grid3 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['故障归类','故障原因','失败次数','失败百分比','用户数'],
                        colmodel: [
                            { name: 'faultclass', index: 'faultclass', sortable: false, align:"center"},
                            { name: 'faultdetail', index: 'faultdetail', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'failpct', index: 'failpct', sortable: false, align:"center"},
                            { name: 'usercount', index: 'usercount', sortable: false, sorttype: 'number', align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    }
                };
                $scope.grid4 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['故障归类','故障原因','失败次数','失败百分比','用户数'],
                        colmodel: [
                            { name: 'type', index: 'type', sortable: false, align:"center"},
                            { name: 'reason', index: 'reason', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'pct', index: 'pct', sortable: false, align:"center"},
                            { name: 'imsi_num', index: 'imsi_num', sortable: false, sorttype: 'number', align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    }
                };
                $scope.grid5 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['业务类型编号','业务类型','流量(MB)','速率(Kbps)','请求次数','上行重传率','下行重传率'],
                        colmodel: [
                            { name: 'service_type_code', index: 'service_type_code', sortable: false, align:"center",hidden:true},
                            { name: 'service_type', index: 'service_type', sortable: false, align:"center"},
                            { name: 'ip_len', index: 'ip_len', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'avg_rate', index: 'avg_rate', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'request_count', index: 'request_count', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'ul_pct', index: 'ul_pct', sortable: false, align:"center"},
                            { name: 'dl_pct', index: 'dl_pct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    },
                    onSelectRow: function (index) {
                        $scope.select_service = $scope.grid5.griddata.data[index - 1]["service_type_code"];

                        $scope.$emit('loading', 'true');
                        $scope.$apply();

                        /*SP(子业务)-速率分析表 */
                        var SubServiceRate = getSubServiceRate();
                        /*MME TAI eNodeB ECGE APN 表 */
                        var MME_TAI_eNodeB_ECGE_APN = getMME_TAI_eNodeB_ECGE_APN();

                        $.when(SubServiceRate,MME_TAI_eNodeB_ECGE_APN).done(function () {

                        }).always(function () {
                                $scope.$emit('loading', 'false');
                                $scope.$apply();
                            })

                    }
                };
                $scope.grid6 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: ['SP','流量(MB)','速率(Kbps)','请求次数','上行重传率','下行重传率'],
                        colmodel: [
                            { name: 'sub_service_type', index: 'sub_service_type', sortable: false, align:"center"},
                            { name: 'ip_len', index: 'ip_len', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'avg_rate', index: 'avg_rate', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'request_count', index: 'request_count', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'ul_pct', index: 'ul_pct', sortable: false, align:"center"},
                            { name: 'dl_pct', index: 'dl_pct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(182);
                    }
                };
                $scope.netName1 = 'MME';
                $scope.gridnet1 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.gridnet1.gridpagedata.nowpage = 1;
                            getnetdetail(getCondition3);
                        },
                        toToppage: function(){
                            if($scope.gridnet1.gridpagedata.nowpage>1){
                                $scope.gridnet1.gridpagedata.nowpage--;
                            }
                            getnetdetail(getCondition3);
                        },
                        toNextpage: function(){
                            if($scope.gridnet1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.gridnet1.gridpagedata.nowpage++;
                            }
                            getnetdetail(getCondition3);
                        },
                        toLastpage: function(){
                            $scope.gridnet1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            getnetdetail(getCondition3);
                        },
                        topage: function(){
                            if($scope.gridnet1.gridpagedata.nowpage<1){
                                $scope.gridnet1.gridpagedata.nowpage = 1;
                            }
                            if($scope.gridnet1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.gridnet1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            getnetdetail(getCondition3);
                        },
                        changePagesize: function(){
                            $scope.gridnet1.gridpagedata.nowpage = 1;
                            getnetdetail(getCondition3);
                        }
                    },
                    griddata: {
                        colnames: [$scope.netName1,'请求次数','失败次数','比例'],
                        colmodel: [
                            { name: 'netgroup', index: 'netgroup', sortable: false, align:"center"},
                            { name: 'requestcount', index: 'requestcount', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'failpct', index: 'failpct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(151);
                    }
                };



                $scope.tabChange1 = function(e){
                    $scope.$emit('loading','true');
                    /*更改表字段名称*/
                    $scope.netName1 = e;
                    $scope.gridnet1.griddata.colnames = [$scope.netName1,'请求次数','失败次数','比例'];
                    /*更新表内容*/
                    var condition =  getCondition3();
                    var f11 = httpservice.javaPost("netfailure.do?method=getnetinfo",condition,function(result){
                        /*MME TAI eNodeB ECGE APN 表 start*/
                        $scope.gridnet1.gridpagedata.totalcount = result.recordCount;
                        $scope.gridnet1.gridpagedata.totalpage = result.totalPage;
                        $scope.gridnet1.gridpagedata.startline =result.startLine;
                        $scope.gridnet1.gridpagedata.endline = result.endLine;
                        $scope.gridnet1.gridpagedata.datacount = result.dataCount;
                        $scope.gridnet1.griddata.data = result.datas;
                        if(result.recordCount>0){
                            $scope.netdetailconditiondown=true;
                            $scope.netdetailcondition=result.condition;
                        }
                        /*MME TAI eNodeB ECGE APN 表 end*/
                        $scope.$apply();
                    });
                    $.when(f11).then(function(){}).always(function(){
                        $scope.$emit('loading','false')
                        $scope.$apply();
                    });

                }


                $scope.gridnet2 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: [$scope.netName2,'请求次数','失败次数','比例'],
                        colmodel: [
                            { name: 'netgroup', index: 'netgroup', sortable: false, align:"center"},
                            { name: 'requestcount', index: 'requestcount', sortable: false, align:"center"},
                            { name: 'failcount', index: 'failcount', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'failpct', index: 'failpct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"},
//                            { "MME": "MME204", "failure": "2222", "proportion": "0.08%"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(151);
                    }
                };


                $scope.gridnet3 = {
                    gridpagedata:{
                        nowpage:1,
                        totalpage:1,
                        totalcount:20,
                        startline:1,
                        endline:20,
                        pagesize:20,
                        datacount:20,
                        pagelist:[20,50,100],
                        toFirstpage: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        },
                        toToppage: function(){
                            if($scope.grid1.gridpagedata.nowpage>1){
                                $scope.grid1.gridpagedata.nowpage--;
                            }
                            $scope.turnPage1();
                        },
                        toNextpage: function(){
                            if($scope.grid1.gridpagedata.nowpage<$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage++;
                            }
                            $scope.turnPage1();
                        },
                        toLastpage: function(){
                            $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            $scope.turnPage1();
                        },
                        topage: function(){
                            if($scope.grid1.gridpagedata.nowpage<1){
                                $scope.grid1.gridpagedata.nowpage = 1;
                            }
                            if($scope.grid1.gridpagedata.nowpage>$scope.grid1.gridpagedata.totalpage){
                                $scope.grid1.gridpagedata.nowpage = $scope.grid1.gridpagedata.totalpage;
                            }
                            $scope.turnPage1();
                        },
                        changePagesize: function(){
                            $scope.grid1.gridpagedata.nowpage = 1;
                            $scope.turnPage1();
                        }
                    },
                    griddata: {
                        colnames: [$scope.netName3,'流量(MB)','速率(Kbps)','请求次数','上行重传率','下行重传率'],
                        colmodel: [
                            { name: 'netgroup', index: 'netgroup', sortable: false, align:"center"},
                            { name: 'ip_len', index: 'ip_len', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'avg_rate', index: 'avg_rate', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'request_count', index: 'request_count', sortable: false, sorttype: 'number', align:"center"},
                            { name: 'ul_pct', index: 'ul_pct', sortable: false, align:"center"},
                            { name: 'dl_pct', index: 'dl_pct', sortable: false, align:"center"}
                        ],
                        data: [
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"},
//                            { "fault": "用户原因", "unmber": "2222", "proportion": "0.08%", "userunmber": "1000"}
                        ]
                    },
                    obj:{},
                    shrinkToFit:true,
                    gridresize: function (grid) {
                        grid.setGridWidth($(window).width()*0.49-33);
                        grid.setGridHeight(151);
                    }
                };
                $scope.highchartyy1 = {
                    chartdata: {
                        title: {
                            text: ''
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: []
                        },
                        yAxis: [
                            { // Secondary yAxis
                                title: {
                                    text: '',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                labels: {
                                    format: '{value}次',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                min:0
                            },
                            { // Primary yAxis
                                labels: {
                                    format: '{value}%',
                                    style: {
                                        color: '#89A54E'
                                    }
                                },
                                opposite: true,
                                min: 0,
                                max:100,
                                title: {
                                    text: '',
                                    style: {
                                        color: '#89A54E'
                                    }
                                }
                            }
                        ],
                        tooltip: {
                            shared: true
                        },
                        series: [
                            {
                                name: '请求次数',
                                color: '#4572A7',
                                type: 'spline',
                                data: [],
                                tooltip: {
                                    valueSuffix: '次'
                                }
                            },
                            {
                                name: '成功率',
                                color: '#89A54E',
                                type: 'spline',
                                yAxis: 1,
                                data: [],
                                tooltip: {
                                    valueSuffix: '%'
                                }
                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartyy2 = {
                    chartdata: {
                        title: {
                            text: ''
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: []
                        },
                        yAxis: [
                            { // Secondary yAxis
                                title: {
                                    text: '',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                labels: {
                                    format: '{value}次',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                min:0
                            },
                            { // Primary yAxis
                                labels: {
                                    format: '{value}%',
                                    style: {
                                        color: '#89A54E'
                                    }
                                },
                                opposite: true,
                                min: 0,
                                max:100,
                                title: {
                                    text: '',
                                    style: {
                                        color: '#89A54E'
                                    }
                                }
                            }
                        ],
                        tooltip: {
                            shared: true
                        },
                        series: [
                            {
                                name: '请求次数',
                                color: '#4572A7',
                                type: 'spline',
                                data: [],
                                tooltip: {
                                    valueSuffix: '次'
                                }
                            },
                            {
                                name: '成功率',
                                color: '#89A54E',
                                type: 'spline',
                                yAxis: 1,
                                data: [],
                                tooltip: {
                                    valueSuffix: '%'
                                }
                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartyy3 = {
                    chartdata: {
                        title: {
                            text: 'EPS去附着指标趋势'
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },

                        plotOptions: {
                            series: {
                                point: {
                                    events: {
                                        click: function () {
                                            $scope.$emit('loading', 'true');
                                            $scope.$apply();
                                            starttime5_forNode = this.category;
                                            var size = $scope.timesize_sl.value;
                                            switch(size){
                                                case '1440':
                                                    endtime5_forNode = starttime5_forNode;
                                                    break;
                                                case '60':
                                                    endtime5_forNode = dateFormat(addMinutes(new Date(starttime5_forNode),60),'yyyy-MM-dd hh:mm');
                                                    break;
                                                case '15':
                                                    endtime5_forNode = dateFormat(addMinutes(new Date(starttime5_forNode),15),'yyyy-MM-dd hh:mm');
                                                    break;
                                                default:
                                                    break;
                                            }
                                            /*业务-速率分析表 */
                                            var ServiceRate = getServiceRate();

                                            $.when(ServiceRate).then(function () {
                                                /*SP(子业务)-速率分析表 */
                                                var SubServiceRate = getSubServiceRate();
                                                /*MME TAI eNodeB ECGE APN 表 */
                                                var MME_TAI_eNodeB_ECGE_APN = getMME_TAI_eNodeB_ECGE_APN();
                                            }).always(function () {
                                                    $scope.$emit('loading', 'false');
                                                    $scope.$apply();
                                                });
                                        }
                                    }
                                }
                            }
                        },

                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            labels: {
                                rotation: -30,
                                align: 'right',
                                style: {
                                    fontFamily: '黑体',
                                    fontWeight: 'Bold'           //Times New Roman
                                }
                            },
                            categories: []
                        },
                        yAxis: [
                            { // Secondary yAxis
                                title: {
                                    text: '',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                labels: {
                                    format: '{value}MB',
                                    style: {
                                        color: '#4572A7'
                                    }
                                },
                                min:0
                            },
                            { // Primary yAxis
                                labels: {
                                    format: '{value}Kbps',
                                    style: {
                                        color: '#89A54E'
                                    }
                                },
                                opposite: true,
                                title: {
                                    text: '',
                                    style: {
                                        color: '#89A54E'
                                    }
                                }
                            }
                        ],
                        tooltip: {
                            shared: true
                        },
                        series: [
                            {
                                name: '流量',
                                color: '#4572A7',
                                type: 'spline',
                                data: [],
                                tooltip: {
                                    valueSuffix: '(MB)'
                                }
                            },
                            {
                                name: '平均速率',
                                color: '#89A54E',
                                type: 'spline',
                                yAxis: 1,
                                data: [],
                                tooltip: {
                                    valueSuffix: 'Kbps'
                                }
                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartcolumn1 = {
                    chartdata: {
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            categories: []
                        },
                        yAxis: {
                            minorTickInterval: 'auto',
                            lineColor: '#000',
                            lineWidth: 1,
                            tickWidth: 1,
                            tickColor: '#000',
                            min: 0,
                            max:100,
                            title: {
                                text: ''
                            },
                            labels: {
                                format: '{value}%'
                            }
                        },
                        tooltip: {
                            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
                            shared: true
                        },
                        plotOptions: {
                            column: {
                                stacking: 'percent'
                            }
                        },
                        series: [
                            {
                                name: '网络原因',
                                data: []
//                            tooltip: {
//                                valueSuffix: '%'
//                            }
                            }, {
                                name: '用户原因',
                                data: []
//                            tooltip: {
//                                valueSuffix: '%'
//                            }
                            },{
                                name: '服务提供商原因',
                                data: []
//                            tooltip: {
//                                valueSuffix: '%'
//                            }
                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartcolumn2 = {
                    chartdata: {
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom',
                            borderWidth: 0
                        },
                        xAxis: {
                            gridLineWidth: 1,
                            lineColor: '#000',
                            tickColor: '#000',
                            categories: []
                        },
                        yAxis: {
                            minorTickInterval: 'auto',
                            lineColor: '#000',
                            lineWidth: 1,
                            tickWidth: 1,
                            tickColor: '#000',
                            min: 0,
                            max:100,
                            title: {
                                text: ''
                            },
                            labels: {
                                format: '{value}%'
                            }
                        },
                        tooltip: {
                            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
                            shared: true
                        },
                        plotOptions: {
                            column: {
                                stacking: 'percent'
                            }
                        },
                        series: [
                            {
                                name: '网络原因',
                                data: []
//                            tooltip: {
//                                valueSuffix: '%'
//                            }
                            }, {
                                name: '用户原因',
                                data: []
//                            tooltip: {
//                                valueSuffix: '%'
//                            }
                            },
                            {
                                name: '服务提供商原因',
                                data: []
//                            tooltip: {
//                                valueSuffix: '%'
//                            }
                            }
                        ],
                        exporting: {
                            enabled:false
                        },
                        credits: {
                            enabled:false
                        }
                    },
                    obj: {}
                };
                $scope.highchartpie1 = {
                    chartdata: {
                        chart: {
                            type: 'pie'
                        },
                        title: {
                            text: "故障分布"
                        },
                        plotOptions: {
                            pie: {
                                allowPointSelect: true,
                                cursor: 'pointer',
                                dataLabels: {
                                    enabled: false
                                },
                                showInLegend: true
                            }
                        },
                        legend: {
                            layout: 'vertical',
                            align: 'right',
                            verticalAlign: 'middle',
                            borderWidth: 0
                        },
//                        tooltip: {
//                            valueSuffix: '%'
//                        },
                        series: [
                            {
                                name: '故障详细',
                                data: [

                                ],
                                cursor: 'pointer',
                                size: '130%'
                            },
                            {
                                name: '故障分类',
                                data: [

                                ],
                                cursor: 'pointer',
                                size: '105%',
                                dataLabels: {
                                    color: 'white',
                                    distance: -30
                                }
                            }
                        ]
                    },
                    obj: {}
                };
                $scope.highchartpie2 = {
                    chartdata: {
                        chart: {
                            type: 'pie'
                        },
                        title: {
                            text: "故障分布"
                        },
                        plotOptions: {
                            pie: {
                                allowPointSelect: true,
                                cursor: 'pointer',
                                dataLabels: {
                                    enabled: false
                                },
                                showInLegend: true
                            }
                        },
                        legend: {
                            layout: 'vertical',
                            align: 'right',
                            verticalAlign: 'middle',
                            borderWidth: 0
                        },
//                        tooltip: {
//                            valueSuffix: '%'
//                        },
                        series: [
                            {
                                name: '故障详细',
                                data: [

                                ],
                                cursor: 'pointer',
                                size: '130%'
                            },
                            {
                                name: '故障分类',
                                data: [

                                ],
                                cursor: 'pointer',
                                size: '105%',
                                dataLabels: {
                                    color: 'white',
                                    distance: -30
                                }
                            }
                        ]
                    },
                    obj: {}
                };
                $scope.init=function(){
                    $scope.$emit('loading', 'true');
                    $scope.$apply();

                    $scope.stime1 = dateFormat(defaultendtime, "yyyy-MM-dd");
                    $scope.etime1 = dateFormat(defaultendtime, "yyyy-MM-dd");


                    var condition = {
                        interface:$scope.interface.value,
                        starttime:$scope.stime1,
                        endtime:$scope.etime1,
                        isbusy:false,
                        timesize:$scope.size.value
                    };


                    var f = getNetWorkIndicatorsList(condition);

                    $.when(f).then(function () {

                    }).always(function () {
                            $scope.$emit('loading', 'false');
                            $scope.$apply();
                        });

                    $scope.$emit('loading', 'false');
                    $scope.$apply();

                };
//                $scope.init();
            };

            angular.module('netPercept-ctrl', [])
                .controller('34GCtrl', ['$scope', 'HttpService', _34Gctrl])
                .controller('CustomCtrl', ['$scope', 'HttpService', customCtrl])
                .controller('NetworkCtrl', ['$scope', 'HttpService', networkCtrl])
                .controller('BusinessCtrl', ['$scope', 'HttpService', businessCtrl])
                .controller('ScenarioCtrl', ['$scope', 'HttpService', scenarioCtrl]);
            /*seajs-content-end*/
        })(jQuery);
    }
});